Hi all,
i need to remove the header for all the files which is ending with .csv and append into one file
example,
test1.csv
test2.csv
test3.csv
i tried with the below command,
sed '1d' test*.csv> appendnew.csv
but it deletes only the first file header. and appending all the files
Thanks,
baski
$ for i in test*.csv; do sed '1d' $i >> append.csv; done
aigles
3
A possible solution :
awk 'FNR>1' test*.csv> appendnew.csv
Jean-Pierre.
awk 'FNR>1{print}' *.csv > out_file
--ahamed
Are you sure that its appending all the test*.csv files to appendnew.csv..? Try with >> instead of >
Thanks for all your replies,
i m just expanding my query,
i can able to delete and append by using the below comman,
awk 'FNR>1{print}' *.csv >> out_file
and i aslo need some particular columns in the csv files , so i tried with this
awk -F"," -v OFS=',' '{print $1, $2,$8}' *csv >> outfile1
above also working fine but i need to merge it into single awk command and also need to sort the cloumns on w.r.t column $2
pls help me on this
thanks,
Baski
awk -F"," -v OFS="," 'FNR>1{print $1,$2,$8}' csv >> outfile1
--ahamed
aigles
8
awk -F"," -v OFS=',' 'FNR>1 {print $1, $2,$8}' *csv >> outfile1
Jean-Pierre.
Thanks a lot ahamed,
and i need to sorting the outputfile w.r.t to $8
Regards,
Baski
awk '{...}' input_file | sort -k3 -t, >> out_file
You are welcome! 
--ahamed
baskivs
11
thanks ahamed,
above is working fine.. and also i need to sort the file w.r.t column $8
Thanks,
BAski
Assuming, $8 in the output file is the 3rd field, sort -k3 -t, should sort it.
Can you paste the output of the awk command?
--ahamed