Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Sorting list of files per date column Post 302255495 by shivaastrogun on Thursday 6th of November 2008 02:04:12 PM
Old 11-06-2008
help need to sort files

Hi,

When I tried to execute below script to sort datefield (eg: 13Aug07_1900), it is not working

cat amex1025 | sort -t"." -k 9.6,9.7 -k 9.3,9.5 -k 9.1,9.2

our file name is: amex1025

-rwxrwxrwx 1 stuprd stuprd 2604 Nov 4 18:27 SONYELEC00.GI22976.13Aug07_1900.gpg
-rwxrwxrwx 1 stuprd stuprd 154129 Nov 4 18:27 SONYELEC00.GI22976.19Apr07_1733.gpg
-rwxrwxrwx 1 stuprd stuprd 146385 Nov 4 18:27 SONYELEC00.GI22976.26Jun08_1900.gpg
-rwxrwxrwx 1 stuprd stuprd 2605 Nov 4 18:27 SONYELEC00.GI22977.13Aug07_1900.gpg
-rwxrwxrwx 1 stuprd stuprd 95605 Nov 4 18:27 SONYELEC00.GI22977.19Apr07_1733.gpg
-rwxrwxrwx 1 stuprd stuprd 147299 Nov 4 18:27 SONYELEC00.GI22977.26Jun08_1900.gpg

please advice5

Thanks
S2
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sorting Files by date and moving files in date order

I need to build a k shell script that will sort files in a directory where files appear like this "XXXX_2008021213.DAT. I need to sort by date in the filename and then move files by individual date to a working folder. concatenate the files in the working folder then start a process once... (2 Replies)
Discussion started by: rebel64
2 Replies

2. UNIX for Dummies Questions & Answers

Get the list of files for a given date

Hi, the command "ls -l" gives the list of files of a directory with details such as date and size. Is there a way to restrict this list to see only files created on a given date? Suppose I want to list only the files created today, what is the command to type? Thanks (3 Replies)
Discussion started by: vanagreg
3 Replies

3. UNIX for Advanced & Expert Users

Help with sorting files according to modification date

Hi, I was very surprised to not be able to find an answer to this question despite my best efforts in Google and elsewhere. Maybe it's a good thing as it forced me to finally become a member in this great forum that i use frequently. Ok my question: I want to be able to sort files inside a... (3 Replies)
Discussion started by: stavros
3 Replies

4. Shell Programming and Scripting

[SOLVED] Sorting into new files based on column

Hi, I have the following file, I need to sort it based on a column and write to different output files based on this column request_guid iso_country_cd address_data response_time 32895901-d17f-414c-ac93-3e7e0f5ec240 AND BaseName:CATALUNYA; HouseNumber:1; ISOCountryCode:AND;... (1 Reply)
Discussion started by: ramky79
1 Replies

5. Shell Programming and Scripting

[Solved] Sorting a column based on another column

hello, I have a file as follows: F0100010 A C F0100040 A G BTA-28763-no-rs 77.2692 F0100020 A G F0100030 A T BTA-29334-no-rs 11.4989 F0100030 A T F0100020 A G BTA-29515-no-rs 127.006 F0100040 A G F0100010 A C BTA-29644-no-rs 7.29827 F0100050 A... (9 Replies)
Discussion started by: Homa
9 Replies

6. Shell Programming and Scripting

Finding files and sorting by date (find | awk)

I am wanting to search a directory tree and return files that are older than a specified datetime. So far straight forward with find, now I want to sort in date order and format the output. So far I have this, but is not working and there is a problem with "." in the file and/or path names. ... (2 Replies)
Discussion started by: larry2311
2 Replies

7. UNIX for Dummies Questions & Answers

Creating a two column list of date pairs form a single column list

Hi all, looking for some help here. I'm what you'd call a dirty programmer. my shell scripts might be ugly, but they (usually) function... Say I have a single column text file with a list of dates (yyyymmdd) that represent the elevation of a point on that date (I work with land subsidence, so... (2 Replies)
Discussion started by: jbrandt1979
2 Replies

8. Shell Programming and Scripting

How to list files that are not first two files date & last file date for every month-year?

Hi All, I need to find all files other than first two files dates & last file date for month and month/year wise list. lets say there are following files in directory Mar 19 2012 c.txt Mar 19 2012 cc.txt Mar 21 2012 d.txt Mar 22 2012 f.txt Mar 24 2012 h.txt Mar 25 2012 w.txt Feb 12... (2 Replies)
Discussion started by: Makarand Dodmis
2 Replies

9. UNIX for Dummies Questions & Answers

Date column validation in files

HI, i have to do some file validations on which i am receving daily.could any one please let me know how we can able to do validations on below scenarios 1) On Date column Ex If i am receving date in format of YYYYMMDD---- 20141118 --- here i have to check the date value 20141142 if the... (7 Replies)
Discussion started by: bhaskar v
7 Replies

10. Shell Programming and Scripting

List the files after sorting based on file content

Hi, I have two pipe separated files as below: head -3 file1.txt "HD"|"Nov 11 2016 4:08AM"|"0000000018" "DT"|"240350264"|"56432" "DT"|"240350264"|"56432" head -3 file2.txt "HD"|"Nov 15 2016 2:18AM"|"0000000019" "DT"|"240350264"|"56432" "DT"|"240350264"|"56432" I want to list the... (6 Replies)
Discussion started by: Prasannag87
6 Replies
Class::DBI::Plugin::RetrieveAll(3pm)			User Contributed Perl Documentation		      Class::DBI::Plugin::RetrieveAll(3pm)

NAME
Class::DBI::Plugin::RetrieveAll - more complex retrieve_all() for Class::DBI SYNOPSIS
use base 'Class::DBI'; use Class::DBI::Plugin::RetrieveAll; my @by_date = My::Class->retrieve_all_sorted_by("date"); # or __PACKAGE__->retrieve_all_sort_field('date'); my @by_date = My::Class->retrieve_all; DESCRIPTION
This is a simple plugin to a Class::DBI subclass that allows for simple sorting of the results of a retrieve_all(). There are two main ways to use this. Firstly, we create a new method 'retrieve_all_sorted_by' which takes an argument of how to sort. We also add a method for 'retrieve_all_sort_field' that sets a default field that any retrieve_all() will use for sorting. METHODS
retrieve_all_sorted_by my @by_date = My::Class->retrieve_all_sorted_by("date"); This method will be exported into the calling class, and allows for retrieving all the objects of the class, sorted by the given column. The argument given will be passed straight through to the database 'as is', and is not checked in any way, so an error here will usually in an error from the database, rather than Class::DBI itself. This makes it possible to pass more complex ORDER BY clauses through: my @by_date = My::Class->retrieve_all_sorted_by("date DESC, reference_no"); retrieve_all_sort_field __PACKAGE__->retrieve_all_sort_field('date'); This method changes the default retrieve_all() in the Class to be auto-sorted by the field given. Again this will be passed through directly, so you can have complex ORDER BY clauses. AUTHOR
Tony Bowden BUGS and QUERIES Please direct all correspondence regarding this module to: bug-Class-DBI-Plugin-RetrieveAll@rt.cpan.org COPYRIGHT and LICENSE Copyright (C) 2004-2006 Kasei. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.0 2006-01-16 Class::DBI::Plugin::RetrieveAll(3pm)
All times are GMT -4. The time now is 04:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy