13

So, basically

THIS LINE WOULD BE DELETED

and

(THIS LINE WOULD ALSO BE DELETED)

but

Indeed, THIS LINE WOULD NOT

ixtmixilix
  • 13,040
  • 27
  • 82
  • 118

2 Answers2

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
geekosaur
  • 31,429
  • 5
  • 79
  • 58
8

Try this:

sed '/[a-z]/!d' file
SiegeX
  • 8,669
  • 3
  • 34
  • 23