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

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

 



Chris W. Parker wrote
> 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.

perl -pi -e 's/([a-z]{1,4})=/\t$1/g' file

-justinb

-- 
Justin Banks
Constant Data, Inc.
http://www.constantdata.com


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