After running my AWK script
awk -i inplace '(NR==FNR){a[$1];next} (FNR in a) && gsub(/\<Source Term\>/,"& Target Term") 1 ' <(shuf -n 198058 -i 1-$(wc -l < file)) file After I checked the file with the command
wc -l file I've noticed that my number of lines from file increased from 40058 to 44156. Is there a reason for that?
Is there any way to keep the number of lines as it was before?
-i inplacewhich would change the file, start by running the command to the terminal and see what it does. It might make sense to use a test file with a smaller subset just for the sake of the test. For instance, create a file with five lines, and lower the-nvalue of yourshufcommand to 3. This would make it easier for you to see the actual output of your awk script, and to make changes and see how it affects the output.-i inplaceand the-n, because this was more a theoretical question. I will consider it in my next question.