What's the easiest way to 'cat' groups of files together?

Posted by rajitha on Super User See other posts from Super User or by rajitha
Published on 2012-06-02T18:39:24Z Indexed on 2012/06/02 22:44 UTC
Read the original article Hit count: 239

Filed under:

I have files with naming convention of this pattern:

bond_7.LEU.CA.1.dat
bond_7.LEU.CA.2.dat
bond_7.LEU.CA.3.dat
bond_12.ALA.CB.1.dat
bond_12.ALA.CB.2.dat
bond_12.ALA.CB.3.dat
...

I want to concatenate all files of the same group into a single one. For example:

cat bond_7.LEU.CA.*.dat > ../bondvalues/bond_7.LEU.CA.1_3.dat

There's large number of these files. How can achieve this with a bash script?

© Super User or respective owner

Related posts about bash-scripting