Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I have a folder with files that have the following names (imagine you typed ls in this folder)
open4233.kbehavior stat3758.kbehavior writev4139.kbehavior
open4235.kbehavior stat3760.kbehavior writev434.kbehavior
open4237.kbehavior stat3762.kbehavior writev912.kbehavior
I would like to concatenate all the files whose name that include the word "open" in a unique file,
I know that I can type cat open*.kbehavior > open_merged.kbehavior
and in the same way I can work with the other files (write, stat).
But, since I have several files with the same stem (e.g. readXXX, closeYYYY, ... )
I would like to write a script that automatically merge them in one file (e.g all read in read_merged). I don't know a priori the number of digits following the stem.
Thank you in advance,
Ok Both are fine solutions. The problem is that I don't know the name of the all the stem in advance. It's very hard to know all them because in the folder there is a huge amount of files.
There are always files that I'm likely to miss (for instance some named sendfile1).I can't lidt all them and write a for loop like "for i open ...".
It would be nice that the script automatically seeks all the stems e.g. read, sendfile,open,write,etc and then concanate as we said.