![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Hi Good Morning | ashokmeti | IP Networking | 3 | 01-30-2008 02:42 PM |
| Pass the source, please - Sydney Morning Herald | iBot | UNIX and Linux RSS News | 0 | 09-25-2007 05:40 AM |
| How do you schedule a command to run at 4:00 every morning? | JosephGerard | UNIX for Dummies Questions & Answers | 1 | 07-21-2005 02:11 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
| Forum Sponsor | ||
|
|
|
||||
|
Quote:
for some reason , not sure why, the backticks in the variable creation were interfering with the sed. Removing the backticks and suddenly it works. I have no idea why though. [code] #!/bin/sh rm b1.dat touch b1.dat j=`wc -l cnt1.txt|awk '{FS=" "};{print $1}'` cnt=1 while [ $cnt -le $j ] ; do match=`sed -n "$cnt p" cnt1.txt |awk '{FS=" "};{print $1}'` replace=`sed -n "$cnt p" cnt1.txt |awk '{FS=" "};{print $2}'` sed -e "s/$match/$replace/g" file.dat >> b1.dat #(I've tried a bazillion different ways to do this line and even setenv at the #command prompt works) cnt=`expr $cnt + 1` done |
||||
| Google The UNIX and Linux Forums |