I have text file input.txt in each of the hundred subfolders named sample_1, ..., sample_100.
I can extract first line of all input.txt files using below command:
find -name input.txt -exec awk 'FNR == 1 {print $0}' > out.txt {} \;
But this prints the first line of all input.txt to one out.txt file in the current directory.
What I want is out.txt in each subfolder with first line of input.txt in that particular subfolder. For example, out.txt inside sample_57 subfolder will have first line of input.txt in sample_57.
Any idea on how to get this done.


