Can anyone come up with an easy solution for the following? I can invent all sorts of multi-line ways of doing it but I can't think of a simple one-liner.
I have (lots of) directories with files with names like the following in them:-
1130938547.25791_1.server:2,RS 1130938547.25791_3.server:2,RS 1130938547.25791_5.server:2,RS 1130940325.30327_1.server:2,RS 1130940325.30327_3.server:2,RS 1130940325.30327_5.server:2,RS 1130945401.24201_1.halkidiki:2,RS 1130945401.24201_3.halkidiki:2,RS 1130945401.24201_5.halkidiki:2,RS
I want to run a shell script for loop on the files in these directories, it's easy enough to use find to recursively run through all the directories, the issue occurs when I do:-
for i in * do # lots of clever (?) things done
The 'for i in *' means that the files are processed in the order shown above with the 'server' files before the 'halkidiki' ones. I want to *guarantee* that the 'halkidiki' ones come first, can anyone come up with a way of doing this?
for i in *halkidiki* *server*
Doesn't work because not all the directories have both server and halkidiki files.