The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ld: fatal: Symbol referencing errors shafi2all Shell Programming and Scripting 1 06-18-2008 09:21 AM
Symbol referencing error fromatz High Level Programming 1 03-17-2008 06:01 PM
symbol referencing error suhasini High Level Programming 1 04-03-2006 06:43 AM
Referencing variables in commands mharley Shell Programming and Scripting 3 03-31-2005 01:37 AM
Referencing a range of parameters? Relykk Shell Programming and Scripting 4 05-02-2004 09:29 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-02-2009
sinpeak sinpeak is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 15
Back Referencing in SED

Hi,

I have tried all examples of back referencing from the web but all in vain.
It would be heavily helpful if someone explains me the use of back referencing and sub expression using an example of substitution.

Thanks
  #2 (permalink)  
Old 01-02-2009
Christoph Spohr Christoph Spohr is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 205
Hi,

Code:
sed 's/a\(..\)a/\1/' <<< "abba"
output:
Code:
bb
The backreference \1 saves the two characters betweens the as.
Everything between \(\) is saved and can be refereced with
\1 to \9 for each \(\).

HTH Chris
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 09:08 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0