I have a directory with many files with common prefix, like gsc*_other.foo
, where * is a character that goes from 0
to 9
or a
/b
(where a
stands for 10
and b
for 11
).
My goal is to create text files with the same gsc*
per each one (that is, the first text file has all the gsc0_other.foo
, the second all the gsc1_other.foo
, and so on).
I just know that I need something like split
, but splitting over a common prefix, instead of a number of lines or size of the files.
I already made a similar script, to list files up to a maximum number of files:
find ./J0902-405/*.evt -maxdepth 1 -type f -printf '%f\n' |
split -l498 -d - files_xselect.list
And I looked for many other way to change this script in what I need (like more split
, xargs
, sed
), but don't have a way to go along with that.