[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: regex question



Alex Samad wrote:
> trying to look at a file with out the comments in it
> i tried grep -v '^\s*;'  ; is the comment delimiter.
> but this left me with lots of blank lines.

Try this:

  sed 's/[[:space:]]*;.*//' file | less -s

The 'less -s' squeezes consecutive blank lines.  See also 'more -s'
and 'cat --squeeze-blank' (but beware that 'cat -s' on SysV systems
means to be silent about missing files).

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: