13

So, basically

THIS LINE WOULD BE DELETED

and

(THIS LINE WOULD ALSO BE DELETED)

but

Indeed, THIS LINE WOULD NOT

17

Quite a few ways. Think negatively:

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
| improve this answer | |
8

Try this:

sed '/[a-z]/!d' file
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.