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...
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...
ya i am trying to sort the specific part of the filename, for the last modified date timestamp i am able to sort this
i tried ls -t | awk -F '_' '{print $3}'
it will output as 20140304202022
how do i output as alex_li_20140304202022_TM1.csv to remain format for
"ls $ln_file_name > $get_file_list_1 ", otherwise , only output timestamp will make my program fail lol
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 ?
Hello Friends,
I would like my script to display date timestamps in the file name for every script execution.
Below is the scenario: (just for testing purpose)
I scheduled a cron job, lets say it runs every 5 min and record/logs output in to a log file.
0,5,10,15,20,25,30,35,40,45,50,55 *... (5 Replies)
Hi Gurus,
I have different files with different timestamp and different base file name, I have to group those files based on basename and provide a unique file name for similar file names.
My Directory has following files.
abc_filename_20130623:00:09:00.txt... (1 Reply)
Hi all.
I am very new to linux scripting and i have a task i can only solve with a script.
I need to sort files base on the date string in their filenames and create a folder using the same date string then move the files to their respective folders.
Scenario:
Folder Path:... (1 Reply)
Hi all.
I am very new to linux scripting and i have a task i can only solve with a script.
I need to sort files base on the date string in their filenames and create a folder using the same date string then move the files to their respective folders.
Scenario:
Folder Path:... (1 Reply)
Hi,
Below is a directory containing links new2,list,new1.
I need to get the size and timestamp for them.
How do i get these details. Please help
lrwxrwxrwx 1 xxx abc 11 Nov 24 17:34 new2 -> ./org1/new2
lrwxrwxrwx 1 xxx abc 11 Nov 24 17:34 list -> ./org2/list
lrwxrwxrwx 1 xxx abc 10... (2 Replies)
Hi.,
My file name is of the format:
name_abc_20100531_142528.txt
where.,
my timestamp is of the format:
yyyymmdd_hhmmss
How to extract the date strring and time string into seperate variables in the shell script, after reading the file as the input?
I want to get the variables... (9 Replies)
Hi
i want to replace the previous time stamp with the current timsatp at the start of the file like
20090710_113354_FT0710a.txt this one to 20091111__113354_FT0710a.txt
thanks in advance (3 Replies)
whats going on guys. below is a script i made and am just curious if there is a "time stamp" command. so i can set the timestamp in a filename.
#! /bin/ksh
#
# This scripts takes a list of files in the INDIR variable and compairs it to a list of files that are open in the same directory.... (2 Replies)