i have a file1 with many lines. i have a script that will let me input a string. for example, APPLE. what i need to do is to copy all lines from file1 where i can find APPLE or any string that i specify and paste in on file 2
thanks in advance!
i have a file1 with many lines. i have a script that will let me input a string. for example, APPLE. what i need to do is to copy all lines from file1 where i can find APPLE or any string that i specify and paste in on file 2
thanks in advance!
no, it's not an assignment.
string=$word
i used awk '/$word/' input_file but it failed
for awk
try -v option
awk -v word=$word ' /$word/ ' file
Should be:
awk -v word=$word ' $0 ~ word' file
With grep:
grep "$word" file