Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, basically

THIS LINE WOULD BE DELETED

and

(THIS LINE WOULD ALSO BE DELETED)

but

Indeed, THIS LINE WOULD NOT

share|improve this question
up vote 16 down vote accepted

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

Try this:

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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