![]() |
|
|
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. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
AWK question
I have file "A" containing keywords as sequential records. For each key word in file "A",
1. need to find the files hat contained the keyword in a given directory 2. Find the file name that contained the first occurance of the keyword 3. Print the record that contatined the first occurance of the keyword I could do this through in-line awk script if [ $MyTest = 1 ] then { while read str; do string=$str let ctr=ctr+1 awk '/'"$string"'/ {print;exit}' /mydir/* >> $outfile done } < $file However, this gives error " parameter too long" error if the there are several files. One suggestion was to run the script from separate file 1. Can some one suggest how the above can be put into separate file? 2. Also is it "awk" limitation that I am getting the error "parameter too long" when running from in-line? Thanks |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|