![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| Sed Help in Updating something only in one particular file. | bisla.yogender | Shell Programming and Scripting | 4 | 03-24-2008 11:48 AM |
| TO know whether file is updating or not | raj333 | Shell Programming and Scripting | 2 | 11-05-2007 05:29 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 03:29 PM |
| sending and updating a file over network | bhakti | High Level Programming | 1 | 09-21-2005 02:10 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Updating file in loop
Hi,
I have a file list containing list of characters to be searched and replaced 'file_master'. I have a datafile 'file_data'. Now, in a loop how do I ensure I'm updating the latest updated file_data when I read the next line of file_master ? file_master a , 1 b , 2 file_ data hello abc baby barbe ..... Quote:
i.e I expect output to be file_ data : hello 12c 212y 21r2e Does the above, make sure for each and every line of master, data is updated ? . It doesn't seem to work Last edited by braindrain; 06-19-2007 at 02:23 PM.. |
|
||||
|
aigles/shell_life, thanks for the reponse.
fyi, I'm trying to replace all the special characters like Ø Ù Ú Û Ü Ý Þ ß etc., For those charcter you mentioned(spaces, backslash, single quote, comma),Cant we use a escape sequence? For instance I can used sed to change comma, if I use different delimiter other than comma. Last edited by braindrain; 06-20-2007 at 04:16 AM.. |
|
||||
|
To be precise,
my file_master can have following character, field1 need to be converted to field2 ( \,+\-,\\ etc) Quote:
like below sed -e 's,÷,\\,g' $src > $src$$ [[ $? -ne 0 ]] && [[ -s $src ]] && mv $src$$ $src || exit 3 sed -e 's,±,\\,g' $src > $src$$ [[ $? -ne 0 ]] && [[ -s $src ]] && mv $src$$ $src || exit 4 but wandering if it can be achevied in master and data file approach (without hardcoding in sed command) . I tried, giving input as ,÷,\\ and ,±,\\ , however when it reads it strips one of the backslash and sed fails. Last edited by braindrain; 06-20-2007 at 03:24 PM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|