add file name to output file along with the line extracted

2017-01-26 Thread Kishore Reddy
Dear group, I am trying to extract 10th line from group of files. I am able to do it with find . -name "*.final.out" | parallel "awk 'NR ==10' {} >> result.txt" However, I need to add a filename in the output file for every line so that I can identify from which file the line came from. Any hel

Re: add file name to output file along with the line extracted

2017-01-26 Thread ChessDoter
find . -name "*.final.out | xargs -l -i awk 'NR==1 {print "{}\n" $1;}' {} Am 26.01.2017 um 18:00 schrieb [email protected]: > add file name to output file along with the line extracted

Re: add file name to output file along with the line extracted

2017-01-26 Thread Shlomi Fish
Hi Mr./Ms. Anekalla, On Thu, 26 Jan 2017 08:23:59 -0600 Kishore Reddy wrote: > Dear group, > > I am trying to extract 10th line from group of files. > I am able to do it with > > find . -name "*.final.out" | parallel "awk 'NR ==10' {} >> result.txt" > > However, I need to add a filename in th