Re: sed - trouble matching end of line

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

 



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


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux