Re: sed

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



on 5-23-2008 11:51 AM Les Mikesell spake the following:
Stephen Harris wrote:
On Fri, May 23, 2008 at 06:59:24PM +0200, Thomas Johansson wrote:
Stephen Harris wrote:

 sed 's/^\([^    ]*[     ]*[^    ]*\)\([   ]*.*\)$/\1.contoso.com\2/'

(where there's a space *and* a TAB inside each of the [  ]  )
The above version easier to read and "copy paste". Space is space and tabe is \t

sed 's/^\([^ \t]*[ \t]*[^ \t]*\)\([ \t]*.*\)$/\1.contoso.com\2/'

I grew up with versions of 'sed' that don't understand this new-fangled
method of specifying tabs, and write enough cross-platform code that
I can't rely on it (still doesn't work in Solaris 10, for example).

perl can do anything sed can do and has almost no platform or version related syntax differences - plus it has \s to represent 'whitespace' and you don't have to bang your head on the wall when you are half done and realize you have to do something spanning multiple lines.

Show your example. Inquiring minds want to know!



--
MailScanner is like deodorant...
You hope everybody uses it, and
you notice quickly if they don't!!!!

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux