删除带有大写字母的单词 [英] Delete words with capital letters

查看:49
本文介绍了删除带有大写字母的单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图删除所有以大写字母开头的单词,但下面只是从第一个单词中捕获Al":

I am trying to delete all words that start with capital letters but below is just catching "Al" from the first word:

echo "Always baby Yeah" | sed -r 's/^([AEIOU].)//g'

如何仅捕获以大写字母开头的所有单词?

How do I capture just all the words starting with capital letters?

推荐答案

您只删除前两个字符,并且仅当它们位于字符串的开头时.

You only remove the first two characters and only if they are at the start of the string.

使用:sed -r 's/\b[AZ]\w*//g''s/\b[AZ]\w*\s*//g' 如果您也想删除空格.

Use: sed -r 's/\b[A-Z]\w*//g' or 's/\b[A-Z]\w*\s*//g' if you want to remove the whitespace too.

这篇关于删除带有大写字母的单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆