Hi, I am a newbie to shell programming and I need some help in sorting a list of files in ascending order of date in the filenames.
The file format is always : IGL01_AC_D_<YYYYMMDD>_N01_01
For example, in a directory MyDirectory I have the following files:
I want to sort and process them in the following ascending order:
Can anyone please help me in achieving this?
I have try with ls comand which only sort the files according to the modification and creating date that UNIX assign to them but that not my goal. The goal is to sort by the date in the filename.
Thanking you in advance.
Last edited by radoulov; 12-26-2011 at 03:40 PM..
Reason: Code tags!
I have a program that will export my data to a single file, but it assigns a file name that is overridden every time I run the program. I need to change the file name to have a sequential number in the filename.
How do I rename a file so that the filename contains the system date and time. I want... (5 Replies)
Hi,
I am new to Unix shell scripting. Can you please help me with this immediate requirement to code.. The requirement is as given below.
In a directory say Y, I have files like this.
PP_100000_28062006_122731_746.dat
PP_100000_28062006_122731_745.dat
PP_100000_28062006_122734_745.dat... (4 Replies)
Hi All,
Sorry to throw this frequent question but I lost my notes on it.
How do you list the files by date? I'm on red hat.
Thanks in advance,
itik (1 Reply)
Hi all,
i'm new here in this forum. I really like the helpful answers in this forum.
Here a short question.
For a script i have to sort files by date and exclude the files of the actual date.
Sorting the files by date and preparing the output for awk is done by this line:
ls -l... (3 Replies)
I know this gets covered quite a bit in the forum and I think there is enough there for me to figure out how to do what I am trying to do, I just don't think I would do it very efficiently so I am going to ask the question...
I have database log files with date and time stamps in the file like
... (7 Replies)
dear all,
i have .dat files named as:
34.dat
2.dat
16.dat
107.dat
i would like to sort them by their filenames as:
2.dat
16.dat
34.dat
107.dat
i have tried numerous combinations of sort and ls command (in vain) to obtain :
107.dat
16.dat
2.dat
34.dat (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)
I need a unix command which will find all the files greater that a particular date in the file name.
say for example I have files like(filenaming cov : filename.YYDDMMSSSS.txt)
abc.201206015423.txt
abc.201207013456.txt
abc.201202011234.txt
abc.201201024321.txt
efg.201202011234.txt... (11 Replies)
Hi,
I have a list of log files as follows:
name_date_0001_ID0.log
name_date_0001_ID2.log
name_date_0001_ID1.log
name_date_0002_ID2.log
name_date_0004_ID0.log
name_date_0005_ID0.log
name_date_0021_ID0.log
name_date_0025_ID0.log
.......................................... (4 Replies)
Discussion started by: alex2005
4 Replies
LEARN ABOUT CENTOS
trace-cmd-restore
TRACE-CMD-RESTORE(1)TRACE-CMD-RESTORE(1)NAME
trace-cmd-restore - restore a failed trace record
SYNOPSIS
trace-cmd restore [OPTIONS] [command] cpu-file [cpu-file ...]
DESCRIPTION
The trace-cmd(1) restore command will restore a crashed trace-cmd-record(1) file. If for some reason a trace-cmd record fails, it will
leave a the per-cpu data files and not create the final trace.dat file. The trace-cmd restore will append the files to create a working
trace.dat file that can be read with trace-cmd-report(1).
When trace-cmd record runs, it spawns off a process per CPU and writes to a per cpu file usually called trace.dat.cpuX, where X represents
the CPU number that it is tracing. If the -o option was used in the trace-cmd record, then the CPU data files will have that name instead
of the trace.dat name. If a unexpected crash occurs before the tracing is finished, then the per CPU files will still exist but there will
not be any trace.dat file to read from. trace-cmd restore will allow you to create a trace.dat file with the existing data files.
OPTIONS -c
Create a partial trace.dat file from the machine, to be used with a full trace-cmd restore at another time. This option is useful for
embedded devices. If a server contains the cpu files of a crashed trace-cmd record (or trace-cmd listen), trace-cmd restore can be
executed on the embedded device with the -c option to get all the stored information of that embedded device. Then the file created
could be copied to the server to run the trace-cmd restore there with the cpu files.
If *-o* is not specified, then the file created will be called
'trace-partial.dat'. This is because the file is not a full version
of something that trace-cmd-report(1) could use.
-t tracing_dir
Used with -c, it overrides the location to read the events from. By default, tracing information is read from the debugfs/tracing
directory. -t will use that location instead. This can be useful if the trace.dat file to create is from another machine. Just tar
-cvf events.tar debugfs/tracing and copy and untar that file locally, and use that directory instead.
-k kallsyms
Used with -c, it overrides where to read the kallsyms file from. By default, /proc/kallsyms is used. -k will override the file to read
the kallsyms from. This can be useful if the trace.dat file to create is from another machine. Just copy the /proc/kallsyms file
locally, and use -k to point to that file.
-o output'
By default, trace-cmd restore will create a trace.dat file (or trace-partial.dat if -c is specified). You can specify a different file
to write to with the -o option.
-i input
By default, trace-cmd restore will read the information of the current system to create the initial data stored in the trace.dat file.
If the crash was on another machine, then that machine should have the trace-cmd restore run with the -c option to create the trace.dat
partial file. Then that file can be copied to the current machine where trace-cmd restore will use -i to load that file instead of
reading from the current system.
EXAMPLES
If a crash happened on another box, you could run:
$ trace-cmd restore -c -o box-partial.dat
Then on the server that has the cpu files:
$ trace-cmd restore -i box-partial.dat trace.dat.cpu0 trace.dat.cpu1
This would create a trace.dat file for the embedded box.
SEE ALSO trace-cmd(1), trace-cmd-record(1), trace-cmd-report(1), trace-cmd-start(1), trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1),
trace-cmd-split(1), trace-cmd-list(1), trace-cmd-listen(1)AUTHOR
Written by Steven Rostedt, <rostedt@goodmis.org[1]>
RESOURCES
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
COPYING
Copyright (C) 2010 Red Hat, Inc. Free use of this software is granted under the terms of the GNU Public License (GPL).
NOTES
1. rostedt@goodmis.org
mailto:rostedt@goodmis.org
06/11/2014 TRACE-CMD-RESTORE(1)