Concatenating a list of files in bash
I had the need to concat a list of files like this:
~/Downloads
file_1.001
file_1.002
file_2.001
file_2.002
file_3.001
file_3.002
file_4.001
file_4.002
The command to concat the files individually would be:
$ cat file_1.00* > file_1
But to do it individually would take a while. Luckily, a simple bash script did the trick:
for f in $(ls *.001); do target=${f%.*} catname=".00*" cat $target$catname > $target; done
There are no comments.