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

Re: sed - trouble matching end of line



On Thu, 30 Oct 2003, Kunkel, Mark wrote:

> We are attempting to use sed to remove blank lines from a stream with:
> 
> sed '/^[ 	]*$/d'
> 

$ cat /etc/services | sed -e 's/\W//g'

s/ means substitute.

^ matches the beginning of the line only so I've no idea why this even works in
cygwin.

\W means all whitespace. (conversely, \w means match a word)

/g means global.

I'm not certain how portable this is, but it does work for me.

I highly recommend reading the regex section in programming perl on the perl dfa
matching engine.

-- 

Matthew Galgoci		"If you were a woman I'd kiss you right now."
System Administrator
Red Hat, Inc
919.754.3700 x44155




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