semi abbasi
semi abbasi

Reputation: 11

how to filter special characters and blank lines in unix

I want to display lines containing blank lines and special characters (?#!%#). i used grep command for special characters but its not working for blank line.

grep -n '[]?#!*%[]' file

if someone can please try this one? Thank you

Upvotes: 1

Views: 184

Answers (1)

Armali
Armali

Reputation: 19375

You can specify multiple patterns with -e options, so in addition to the present pattern you can give another one for lines containing nothing but blanks:

grep -n -e '[]?#!*%[]' -e '^ *$' file

Upvotes: 2

Related Questions