I have this script below that allows me to rename a file based on the word I find in a file. Is there an easier way of doing this? I will be executing this script remotely from another server after it ftp's the file to another server.
#/bin/ksh
grep "*IUNB" t.edw > r.out
cut -c 6-10 r.out > r.in
touch a-riv`cat r.in`.edw
mv t.edw a-riv`cat r.in`.edw
t.edw = source file
r.out = stores the grep line
r.in = stores the name I was looking for
a-riv`cat r.in`.edw will be the new name of the file keeping the original contents of t.edw
#/bin/ksh
grep "*IUNB" t.edw > r.out
cut -c 6-10 r.out > r.in
touch a-riv`cat r.in`.edw
mv t.edw a-riv`cat r.in`.edw
t.edw = source file
r.out = stores the grep line
r.in = stores the name I was looking for
a-riv`cat r.in`.edw will be the new name of the file keeping the original contents of t.edw