Need a shell script help - grepping list of entries from another file?
I made this short shell script for having a file1 giving list of entries that I want to grep out of file2.
Code:
#!/bin/sh |
Please show us an example of the input file ($2 in your script) and the search list ($1) especially the not working part of them. Also take in mind that you can use the -f option of grep to read patterns from a file, so that you don't need to use a loop:
Code:
grep -A30 -f $1 $2 |
Your example works straight out of the box and does not mess the stuff up like my trial. Thx.
However, I am still at least academically interested in the solution. So for this reason. If file 1 has for example: CONNECTOR BEHAVIOR, NAME=M1901479;SPW_WF-1901479 It begins by listing all lines from file2 where only word CONNECTOR is present and then with BEHAVIOR, and then I believe it searches NAME=M1901479;SPW_WF-1901479 So all in all I think it is allergic to spaces in my file1 and treats a line as three separate strings So perhaps it is in the layout of for - loop and using cat. |
Quote:
Code:
while read line |
All times are GMT -5. The time now is 01:21 PM. |