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



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-28-2004
Registered User
 

Join Date: Jun 2001
Posts: 35
sed example?

All,

Given the followng example, I have about 5000 files in which on the ACSENDDIR line below, I need to put in 2 backslashes for every occurance of a backslash that starts with ACSENDDIR or ACRECVDIR AND contains a backslash already. I am pretty sure I can do this with sed but have been unable to find anything on the net or man pages with regards to special charactors.

line....
line....
ACSENDDIR="\Inbound\3RDPARTY"
another line....
another line....

I need to convert it to this..

line..
line..
ACSENDDIR="\\Inbound\\3RDPARTY"
another line..
another line..



thanks in advance!
Sponsored Links
  #2 (permalink)  
Old 03-01-2004
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,431
You have to escape the backslash...

sed '/AC[SR]E[NC][DV]DIR/s/\\/\\\\/g' file1
  #3 (permalink)  
Old 03-24-2009
Registered User
 

Join Date: Mar 2009
Posts: 2
sed example

The above should work, if you need some more help try: sed examples

good luck
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 Off




All times are GMT -4. The time now is 12:22 AM.


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

Content Relevant URLs by vBSEO 3.2.0