![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| TO know whether file is updating or not | raj333 | Shell Programming and Scripting | 2 | 11-05-2007 05:29 PM |
| Updating file in loop | braindrain | Shell Programming and Scripting | 4 | 06-20-2007 02:37 PM |
| Why my sar is not updating the output file. | skneeli | UNIX for Advanced & Expert Users | 1 | 11-12-2006 08:29 PM |
| Updating a File in a Zip Archive | dbridle | AIX | 6 | 09-27-2006 04:29 PM |
| sending and updating a file over network | bhakti | High Level Programming | 1 | 09-21-2005 03:10 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi,
The scenerio is that I want to replace a text in one particular line of a file. But when I am using the sed it's replacing all the occurences of that text. Like the file is: >cat test DNGGF10 :None :Test DNGGF11 :ABC :Test1 DNGGF12 :None :Test2 DNGGF13 :None : Test3 I have written the following code for this:- >cat script name=$1 sed "s/`grep DNGGF10 test|cut -d ':' -f2`/$1/" test >test.chk But while executing the code as ./script yogi then I am getting O/p in test.chk as: >cat test.chk DNGGF10 :Yogi:Test DNGGF11 :ABC :Test1 DNGGF12 :yogi:Test2 DNGGF13 :Yogi: Test3 But i want to replce second field only for that line which contains DNGGF1O i.e the 1st line.Also space total sapce in second field should also not get altered. Kindly shed some light on it. Thanks- Yogi Last edited by bisla.yogender; 03-24-2008 at 09:27 AM.. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|