Hi,
I am having an '.xml' file with 'n' number of lines and also having another file with '.txt' format contains values which i want to search.
Now I want to print the next line with the pattern which i am searching in '.xml' file. And the loop has to repeat for different patterns which are present in '.txt' file.
the logic which i used is
while read line
do
awk -f '/$line/ {for(j=1; j<=1; j++) {getline; print}}' sample.xml >> output.txt
done< values.txt
for the above logic i am getting error as
awk -f '/$line/ {for(j=1; j<=1; j++) {getline; print}}' sample.xml
awk: fatal: can't open source file `/$line/ {for(j=1; j<=1; j++) {getline; print}}' for reading (No such file or directory)
in this logic, the value is reading by the variable 'line' and it is not evaluating in the awk cmd.
Can anyone advise on this?