1

Substr with awk

view story
linux-howto

http://www.unix.com – Hi to all, I'm here again, cause I need your help to solve another issue for me. I have some files that have this name format: date_filename.csv In my shell I must rename each file removing the date so that the file name is filename.csv To do this I use this command: Code: fnames=`ls ${fname}| awk '{ FS = "_*" } ; { print $2 }'` where fname contain, for example, 20120906_TESTFILE.csv In this case it works correctly and return only the name TESTFILE.csv Unfortunately in the file we receive from external systems there are some file that have in the name the '_' so some file (HowTos)