
如果从文件中删除所有行,如果它们以小写字符或标点符号开头?
A bamboo forest is located towards the ruins. a banana . aban Bajramovi was a Serbian-Romani musician. Abancay is a city in southern-central Peru. ! a ban is the strictest punishment.
我想我的输出只是:
A bamboo forest is located towards the ruins. Abancay is a city in southern-central Peru.
我正在尝试sed
sed 's/^[AZ]/d' input
但没有得到预期的结果,任何提示?
使用awk在单独的行上的多个字段的math
我如何在Perl中使用粘贴和awk?
如何检查awk数组是否为空
awk系统不需要连字符
使用linux命令sedselect多行
AWK首先打印$ 2,然后打印$ 1
bash脚本抓取屏幕输出并parsing为csv
如何在shell脚本中recursion地使用粘贴命令
如何查找相同大小的文件?
用AWK增加date几天和几个月
尝试这个:
sed '/^[az[:punct:]]/d' file
或者你也可以像@glennjackman所建议的那样在字符类中使用注释:
sed '/^[[:lower:][:punct:]]/d' file
$ cat file A bamboo forest is located towards the ruins. a banana . aban Bajramovi was a Serbian-Romani musician. Abancay is a city in southern-central Peru. ! a ban is the strictest punishment.
$ sed '/^[az[:punct:]]/d' file A bamboo forest is located towards the ruins. Abancay is a city in southern-central Peru.
$ sed '/^[[:lower:][:punct:]]/d' file A bamboo forest is located towards the ruins. Abancay is a city in southern-central Peru.
我认为你真正想要的是:
$ grep '^[[:upper:]]' file A bamboo forest is located towards the ruins. Abancay is a city in southern-central Peru.
我会使用一个正则表达式来定位你想要省略的行,然后使用grep的-v标志来返回其他的东西 :
grep -v '^[az[:punct:]]' < input
这是一个awk
awk '!/^[[:lower:][:punct:]]/' file A bamboo forest is located towards the ruins. Abancay is a city in southern-central Peru.
总结以上是内存溢出为你收集整理的删除所有以小写字母开头的行全部内容,希望文章能够帮你解决删除所有以小写字母开头的行所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)