Re: help with sed... doesn't use standard regex?

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

 




---
I never saw a purple cow.
I never hope to see one.
But I'll tell you this anyhow;
I'd rather see than be one.

>Hey everyone,
>
>I've read the man page and I've googled for about 30 minutes now and
>have not found an answer.
>
>I've got a file with thousands of lines like this:
>
>Oct 21 04:01:05 10.0.0.1 id=name x=value y=value time="timestamp" ...
>
>
>What I want to do is put a tab in front of every [a-z]{,4}. During my
>googling I found that \t doesn't add a tab when used on the command line
>so you have to create a sed script and use the tab key instead. My sed
>script looks like this:
>
>s/([a-z]{,4})=/	$1=/g
>
>As far as I know I am using the correct regex to solve my problem but
>when I run this script on my file I don't get any changes at all to the
>output file. I've even tried:
>
>s/([a-z])/zaq$1/g
>
>Still nothing.
>
>
>Can someone let me know what I'm doing wrong?
>
>
>Thanks,
>Chris.


s/([a-z]{,4})=/
should be 
's/\([a-z]\{4,\})=/     \1=/g'
This will store 4 or more lowercase letters put a tab in front and an = sign after it.


____________________________________________________________
Enter for a chance to win one year's supply of allergy relief!
http://ad.doubleclick.net/clk;6413623;3807821;f?http://mocda3.com/1/c/563632/125699/307982/307982
This offer applies to U.S. Residents Only


-- 
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