I would like to put the following lines of code in a function:
LINE_COUNT=`wc -l ${LOCAL_DIR}/FileList.txt`
COUNT=`echo $LINE_COUNT | cut -s -d' ' -f1`
FILENAME=`cat ${LOCAL_DIR}/FileList.txt | /usr/xpg4/bin/awk -v mycount=${COUNT} 'BEGIN{FS=" "} {if(NR == mycount) {print $9}}'`
The function would take ANY 'filelist.txt' and would return the 'filename'. The contents of the 'filelist.txt' would be as follows:
-rw-rw-rw- 1 user group 631 May 16 16:26 test_20050516_163000.txt
-rw-rw-rw- 1 user group 631 May 16 16:41 test_20050516_164500.txt
-rw-rw-rw- 1 user group 630 May 16 16:56 test_20050516_170000.txt
-rw-rw-rw- 1 user group 631 May 16 17:11 test_20050516_171500.txt
LINE_COUNT=`wc -l ${LOCAL_DIR}/FileList.txt`
COUNT=`echo $LINE_COUNT | cut -s -d' ' -f1`
FILENAME=`cat ${LOCAL_DIR}/FileList.txt | /usr/xpg4/bin/awk -v mycount=${COUNT} 'BEGIN{FS=" "} {if(NR == mycount) {print $9}}'`
The function would take ANY 'filelist.txt' and would return the 'filename'. The contents of the 'filelist.txt' would be as follows:
-rw-rw-rw- 1 user group 631 May 16 16:26 test_20050516_163000.txt
-rw-rw-rw- 1 user group 631 May 16 16:41 test_20050516_164500.txt
-rw-rw-rw- 1 user group 630 May 16 16:56 test_20050516_170000.txt
-rw-rw-rw- 1 user group 631 May 16 17:11 test_20050516_171500.txt