Computing.Net > Forums > Unix > Sed help

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Sed help

Reply to Message Icon

Original Message
Name: vibhor_agarwalin
Date: February 7, 2005 at 06:00:47 Pacific
Subject: Sed help
OS: Solaris
CPU/Ram: sparc
Comment:

Hi,

In sed it sometimes uses
sed -e '.../.../.../\1'
whats the use of \1 or any other number there.

Vibhor Kumar Agarwal


Report Offensive Message For Removal


Response Number 1
Name: vgersh99
Date: February 7, 2005 at 06:11:47 Pacific
Reply: (edit)

man sed:

The characters \n, where n is a
digit, will be replaced by the text matched by
the corresponding backreference expression.
For each backslash (\) encountered in scanning
replacement from beginning to end, the follow-
ing character loses its special meaning (if
any).

vlad
#include<disclaimer.h>


Report Offensive Follow Up For Removal

Response Number 2
Name: vibhor_agarwalin
Date: February 8, 2005 at 05:34:53 Pacific
Reply: (edit)

Ooops,

I read it, but somehow it didn't click, or i was unable to corelate.
Sometimes just a tinkle helps.

Another required now.
This works only when i use:
s/\(.*\)xyz/\1XYZ/
i.e. \(.*\)
What does this specify.

Vibhor Kumar Agarwal


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History




Data Recovery Software