Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 06-11-2008, 07:58 PM   #1 (permalink)
Alpha Geek
 
raksrules's Avatar
 
Join Date: Nov 2006
Location: Mumbai <-> Pune
Posts: 527
Default Help needed on substitution in Unix (sed)


I am using the following command in my UNIX code

Code:
sed "s/$FIND/$REPLACE/g" $IMP_RECORD_CTL > c.ctl
This command replaces all instances of $FIND with $REPLACE. These two variables contain some data and it operates on data contained in variable $IMP_RECORD_CTL and stores the result in file named c.ctl

Now after this i am using the following command

Code:
cat c.ctl | sed "s/POSITION FILLER/POSITION CONSTANT/g" > d.ctl
Here i am opening the file c.ctl (created above) and passing its contents to the sed command which will replace all instances of string "POSITION FILLER" with "POSITION CONSTANT" and put the contents in d.ctl

Now i want to effectively do both of these substitutions in the same file using a single command ( or something similar) . How can i achieve this ?

I mean i dont want to first substitute and put data in file c.ctl and then again substitute and put in d.ctl
raksrules is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 06-11-2008, 09:16 PM   #2 (permalink)
Wahahaha~!
 
Faun's Avatar
 
Join Date: Dec 2006
Location: Pune/there
Posts: 7,676
Default Re: Help needed on substitution in Unix (sed)

lolz I may be silly but do you want it on single line or altogether different command ?
__________________
Blog | Flickr | Battlelog
Spoiler:
Asus Z68 V-Pro|i5 2500k|TRUE Black|Ripjaws X|U2311H|N560GTX|D7000|XONAR STX|RE272|RE0|CC51|XE200PRO Walnut| TD II V2| Ultraphile|N5800

Mono
Faun is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
C & Unix Matrix Programming 3 09-09-2006 01:14 AM
Unix Ishan Software Q&A 7 04-05-2006 05:31 PM
UNIX ECE0105 Open Source 36 27-08-2005 05:05 PM
unix imported_renault QnA (read only) 2 19-05-2005 07:56 PM
help @unix mohit sharma Open Source 5 15-02-2005 01:28 PM

 
Latest Threads
- by gforz
- by soumya
- by Sujeet
- by icebags
- by Charan

Advertisement




All times are GMT +5.5. The time now is 02:58 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2