Sponsored Content
Top Forums Shell Programming and Scripting Sort files by date in filename Post 302584997 by Yuggy on Tuesday 27th of December 2011 04:01:03 AM
Old 12-27-2011
Many many thanks to you. That was the way I play with your above reply:
Infact on production the filename has the following format:

IGL01_AC_D_<YYYYMMDD>_<N01>_<01>.dat where all the paramaters in angular brakets can be changed. N01 becomes N02 etc, 01 becomes 02 03 etc and
<YYYYMMDD> also.
From your code, I undertstood that -k4,4 is the position in the filename on which I want to sort..am i right?

I used your above logic to sort the file on the three columns with :

Code:
ls IGL01*.dat | sort -t_ -k4,4 -k5,5 -k6,6

Works pretty good..thank you again very much Smilie

Last edited by radoulov; 12-27-2011 at 09:17 AM.. Reason: Code tags.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Renaming files to have date/time in filename

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)
Discussion started by: wayneb
5 Replies

2. Shell Programming and Scripting

Sort files by Date-timestamps available in filename & pick the sortedfiles one by one

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)
Discussion started by: Chindhu
4 Replies

3. Linux

sort files by date

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)
Discussion started by: itik
1 Replies

4. UNIX for Dummies Questions & Answers

Sort files by date, not showing files from today

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)
Discussion started by: carlosdivega
3 Replies

5. Shell Programming and Scripting

Move files based on date in filename

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)
Discussion started by: slatoms
7 Replies

6. UNIX for Dummies Questions & Answers

sort files by numeric filename

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)
Discussion started by: chen.xiao.po
1 Replies

7. Shell Programming and Scripting

URGENT!!! bash script to sort files into folder according to a string in the filename

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)
Discussion started by: ace47
1 Replies

8. Shell Programming and Scripting

Bash script to sort files into folder according to a string in the filename

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)
Discussion started by: ace47
1 Replies

9. Shell Programming and Scripting

Find files greater than a particular date in filename.

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)
Discussion started by: lijjumathew
11 Replies

10. Shell Programming and Scripting

Sort log files based on numeric value in the filename

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
ACPIDUMP(1)						      General Commands Manual						       ACPIDUMP(1)

NAME
acpidump - dump a system's ACPI tables to an ASCII file acpixtract - convert ASCII acpidump output to raw binary table turbostat - gather performance statistics SYNOPSIS
acpidump [options] acpixtract [options] [filename] turbostat [options] [command [arg]...] DESCRIPTION
This manual page documents briefly the acpidump , acpixtract and turbostat commands. turbostat reads hardware registers and gather statistics on the processor clock frequency and C-state usage. Works properly on Nehalem and newer processors and on Linux kernel 2.6.30 and later versions. OPTIONS
acpidump options are as follow: -a, --addr 0x1234 look for tables at this phisical address -t, --table DSDT only dump table with DSDT signature -o, --output filename redirect output from stdout to filename -b, --binary dump data in binary form rather than in hex-dump format -l, --lenght 0x456 works only with --addr, dump phisical memory region without trying to understand it's contents -s, --skip 2 skip 2 tables of the given name and output only 3rd one -h, --help outputs an help message OPTIONS
acpixtract options are as follow: -a extract all tables, not just DSDT/SSDT -l list table summaries, do not extract -s<Signature> Extract all tables named <Signature> OPTIONS
turbostat options are as follow: -v makes turbostat more verbose -i <sec> polling interval, default is 5 When given a command turbostat runs it and outputs statistics gathered while the program was running. EXAMPLES
Dump the DSDT table to the file DSDT.aml in binary format (this can be disassembled later with iasl(1)): acpidump -b -t DSDT -o DSDT.aml Show the FACP table: acpidump -t FACP > FACP.dat acpixtract -a FACP.dat iasl -d FACP.dat Dump and extract all ACPI tables: acpidump -o DSDT.dat acpixtract -a Parse APIC tables: acpidump -o DSDT.dat acpixtract -sAPIC DSDT.dat SEE ALSO
iasl(1), AUTHOR
acpidump was written by Alexey Starikovskiy and Len Brown. This manual page was written by Mattia Dongili <malattia@debian.org>, for the Debian project (but may be used by others). October 19, 2005 ACPIDUMP(1)
All times are GMT -4. The time now is 05:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy