Hi Gurus,
I have n number of files. Data which is in the files have column headers. I need to take them out and merge into one file.
Can you help please?
I need to do that little urgent.
Thanks
for file in $listOfNfiles
do
tail +2 $file >> outputfile
done
This will create "outputfile" containing everything from line 2 onwards from each of your files.
1 Like
for file in $file_list
do
awk ' NR != 1 ' $file >> New_File
done
1 Like
A small nitpick, there is a small difference in performance between
for ...;do cmd >> file;done
and
for ...;do cmd; done > file
The latter only opens the output file once.
With GNU sed, you can do
sed -s 1d $file_list > merged-file
1 Like
one more using awk
for file in $file_list
do
awk ' NR>1 ' $file >> New_File
done