I have many files that have the same prefix, only the bit after the underscore is different. And I have many prefixes as well! Underscore does not appear anywhere else in th
In case your amount of files is very large, then sometimes just using shell globbing (prefix_*
and the like) isn't suitable.
You can use a loop and append them one by one then:
find dir -type f -name 'prefix_*' -exec bash -c 'cat "{}" >> result' \;
This will append all files matching prefix_*
one by one to the file result
(which shouldn't exist in the beginning, if in doubt use rm result
).
If you have lots of different prefixes, you can of course append one group after the other without removing the result
file in between.
All the other options the Unix tool find
offers can be used as well of course. But if you need help with that, feel free to ask again.