sed单行删除所有不包含小写字母的行


13

所以,基本上

此行将被删除

(也将删除此行)

确实,这条线不会

Answers:


17

几种方法。负面思考:

sed '/[a-z]/!d'    # !x runs x if the pattern doesn't match
grep -v '[a-z]'    # -v means print if the regexp doesn't match
awk '!/[a-z]/'     # !expr negates expr

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.