For example suppose I have 1.csv, 2.csv, ... , 20.csv. Is there a simple shell script where I can merge everything into merged.csv?
Use cat to concatenate them.
cat *.csv > merged.csv
As @sarnold points out this will concatenate them out of order. If that's important, use his for loop suggestion, or this xargs pipeline:
ls *.csv | sort -n | xargs cat > merged.csv
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With