How do I delete lines beginning with a #, given that there can be whitespace on the left and right of the #?
# Master socket provides access to userdb information. It's typically
|
How do I delete lines beginning with a
|
||||
|
|
|
||||
|
|
|
Using the sample data posted by ДМИТРИЙ МАЛИКОВ...
I prefer using pcre with grep so I use the -P switch for grep (must be GNU grep). The second grep is pure sugar to give you the words with no white-space. It would also "remove" empty lines. |
|||
|
|
|
|||
|
|
|
||||
|
This seems to work, but I've not given deep thought to it:
|
|||||||||
|
|
You can use
Since, as I presume, you are stripping comments from some file, you might also consider removing empty lines, which expands the above to:
|
|||
|
|