#ln_file_name=`echo $ld_interface_date"_"${8}".csv"`
#ln_file_name=`echo 201202011527_HL_HLTM1_B04A.csv`
ln_file_name="*"`echo ${7}".csv"`
get_file_list_1=$log_path"tm1_file_list.gfl1"
cd ${source_path}
echo "Try to find any file exist in the source_path"
ls $ln_file_name > $get_file_list_1
# Count the number of files exist in source_path
if ( test -s $get_file_list_1 )
how do i change this code "ls $ln_file_name > $get_file_list_1 "to sort the
timestamp in fielname?
the fielname format "alex_li_20140304102033_TM1" 20140304102033 is the timestamp
for example
alex_li_20140304102033_TM1.csv
BB_li_20140304112033_TM1.csv
BX_li_20140304082043_TM1.csv
BC_li_20140304202033_TM1.csv
after the sort it will be the oldest file list first
The ls command will sort the files only if the timestamp of those files is the same as that embedded in the filename otherwise you'd have to use awk or perl for sorting on that specific part of the filename...
thanks for your answer, it work, but i discover that
the format is a bit different for users,
alex_li_20140304121212_tm1.csv
alex_cf_li_20140304121212_tm1.csv
there might be some user with extra underscore.
so counting from suffix is better, the time stamp si always before tm1.csv, how do i change ls *.csv | sort -t -k3,3n to count the segment before _tm1.csv ?