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

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

 



Several problems.  First, I have never seen the {,4} syntax you are using.  
Nor is it in the 'ed' man page that documents the regex.  However, assuming 
you are trying to get exactly four characters, heres what you need to do:

s/\([a-z]\{4\}\)=/	\1=/g

Note that you have to escape the parantheses, the curlies, and use \1 
instead of $1.


On Fri, 24 Oct 2003, 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.
> 
> 
> Can someone let me know what I'm doing wrong?
> 
> 
> Thanks,
> Chris.
> 
> 
> 

-- 
F. Michael Orr
Computer Systems Sr. Engineer
Virginia Community College System


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