Ok, I have many files in a folder that have the string "$varname.txt"` in their name:
for file in find output/ -name "*$varname*.txt" -type f; do echo $file; done
...
now these files all have two lines and 9 columns to them. I want to add the content of line 2, col 9 to the end of their filname (right before the .txt
).
So I know how to print the value of in cell(2, 9) of all these files:
find output/ -name "*$varname*.txt" -type f -exec awk -F' ' 'NR==2{print $9}' {} \;
What I struggle with is how to put that string as the last thing before the extension in those filenames