Create a name of a file by comparison of strings

view story

http://www.unix.com – Hello everybody, I need to create a file name from string. The thing is: I have a directory with files e.g: test.123 test.234 test.345 test.987 The name should be made from the first and last name of file alphabetically and from the directory, they are in, eg. 201208_test.123_test.987 I used this commands to do that: Code: test_nums=`find ./$subdir -maxdepth 1 -mindepth 1 -name "batch.*" -newer  begin.tmp ! -newer end.tmp -printf '%f\n' | sort | tr '\n' ' ' | awk '{ print $1"_"$NF }' and $subdir is in the form like 2012/08: Code: subdir1=`echo (HowTos)