01-03-2012
Quote:
Originally Posted by
Glitch100
Methyl, appreciate the help, however I did have that sort the first time round, starting the years first but I still have the same problem; Could it be my translation messing about with the ',' and '/'s?
Also rhyno, I did try what you said before methyl posted an answer;
I swapped the date to the first part of the file, and then used the delimiter as the / to skip apart however I thought it would but no luck.
So the problem I still have is that the -k only does one part of sorting.
So in this example it has only sorted the last part of testData.csv
Post your new sort code, might as well have a crack it now you have the answer anyway :P
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I am having a pipe delimited file .In this file the 3rd column is having date values.I need to get the min date and max date from that file.
I have used
cut -d '|' test.dat -f 3|sort -u
But it is not sorting the date .How to sort the date column using unix commands
Thanks ... (4 Replies)
Discussion started by: risshanth
4 Replies
2. Shell Programming and Scripting
:cool:
Hi all,
I have a pecular issue in sorting these files in Solaris environment.
All the below files are modified on November 4th, but I want to sort these files as per date column (eg: 01May07_1623 = ddmmmyy_hhmm)
Nov 4 18:27 SONYELEC00.GI22973.01May07_1623.gpg
Nov 4 18:27... (4 Replies)
Discussion started by: shivaastrogun
4 Replies
3. Shell Programming and Scripting
I want to sort alphabetically on the first field and sort in descending numerical order on the 2nd field. With a normal "sort -r -n" it does this:
abc ||| 5e-05 ||| bla
abc ||| 3 ||| ble
def ||| 1 ||| abc
def ||| 0.2 ||| def
As you can see it ignores the fact that 5e-05 is actually 0.00005... (1 Reply)
Discussion started by: FrancoisCN
1 Replies
4. Shell Programming and Scripting
Hi,
I have a set of columns in a csv file, my first row being an integer and 2nd being a date. I want to first sort it using the first column and then by the second.
for e.g. i have ,
1234,09/05/2009,hi
5678,01/01/2008,hi
1234,11/03/2006,hello
5678,28/07/2010,hello
i tried this... (5 Replies)
Discussion started by: sweta_doshi
5 Replies
5. Shell Programming and Scripting
Hi all,
Sorry the title is a mess, but did not find a better description at the time.
So here is my problem:
I have an input file:
8:Mass40s -- 0
48:Mass40s -- 0
67:Mass40s -- 0
86:Mass40s -- 0
105:Mass40s -- 0
9:Mass -- 1
49:Mass -- 86... (5 Replies)
Discussion started by: Alexis Duarte
5 Replies
6. Shell Programming and Scripting
Hi,
I have a file that has data in it that says
00:01:48.233 1212
00:01:56.233 345
00:09:01.221 5678
00:12:23.321 93444
The file has more line than this but i just wanted to put in a snippet to ask how I would get the highest number with time stamp into another file. So from the above... (2 Replies)
Discussion started by: pat4519
2 Replies
7. UNIX for Dummies Questions & Answers
Hello Group,
I would like to sort the below file by date (first year then month and day) and I used the following command but it does not work
sort -n -t"/" -k3 -k1 -k2
"sample original file"
12/28/2009,1.0353
12/31/2009,1.0357
12/30/2009,1.0364
12/29/2009,1.0366
12/24/2009,1.0386... (6 Replies)
Discussion started by: csierra
6 Replies
8. Shell Programming and Scripting
Hi Experts,
I have a filelist collected from another server , now want to sort the output using date/time stamp filed.
- Filed 6, 7,8 are showing the date/time/stamp.
Here is the input:
#----------------------------------------------------------------------
-rw------- 1 root ... (3 Replies)
Discussion started by: rveri
3 Replies
9. Linux
I have a .CSV file (file.csv) whose data are all enclosed in double quotes. Sample format of the file is as below:
column1,column2,column3,column4,column5,column6, column7, Column8, Column9, Column10
"12","B000QRIGJ4","4432","string with quotes, and with a comma, and colon: in... (3 Replies)
Discussion started by: dhruuv369
3 Replies
10. AIX
I wanted to sort the below data on 4th field(comma seperator) based on month and date and time on AIX OS.
Input data:
3,AJ,30 Jul 06:30,30 Jul 06:30
5,AJ,30 Jul 06:30,30 Jul 06:49
10,AJ,30 Jul 06:30,02 Jan 05:41
4,AJ,30 Jul 06:30,30 Jul 06:36
2,AJ,30 Jul 06:30,28 Jul 06:45
9,AJ,30 Jul... (2 Replies)
Discussion started by: Amit Joshi
2 Replies
LEARN ABOUT MOJAVE
mail::field::date5.18
Mail::Field::Date(3) User Contributed Perl Documentation Mail::Field::Date(3)
NAME
Mail::Field::Date - a date header field
INHERITANCE
Mail::Field::Date
is a Mail::Field
SYNOPSIS
use HTTP::Date 'time2iso';
my $field = Mail::Field->new(Date => time2iso());
DESCRIPTION
Represents one "Date" header field.
See documentation in the base class.
METHODS
See documentation in the base class.
Constructors
See documentation in the base class.
Mail::Field::Date->combine(FIELDS)
See "Constructors" in Mail::Field
Mail::Field::Date->extract(TAG, HEAD [, INDEX ])
See "Constructors" in Mail::Field
Mail::Field::Date->new(TAG [, STRING | OPTIONS])
See "Constructors" in Mail::Field
"Fake" constructors
See documentation in the base class.
$obj->create(OPTIONS)
See ""Fake" constructors" in Mail::Field
$obj->parse()
See ""Fake" constructors" in Mail::Field
Accessors
See documentation in the base class.
$obj->set(OPTIONS)
-Option --Default
Time undef
TimeStr undef
Time => SECONDS
TimeStr => STRING
A string acceptable to Date::Parse.
$obj->stringify()
See "Accessors" in Mail::Field
$obj->tag()
Mail::Field::Date->tag()
See "Accessors" in Mail::Field
Smart accessors
See documentation in the base class.
$obj->text([STRING])
See "Smart accessors" in Mail::Field
$obj->time([TIME])
Query (or change) the TIME (as stored in the field) in seconds.
DETAILS
See documentation in the base class.
DIAGNOSTICS
Error: Undefined subroutine <method> called
Mail::Field objects use autoloading to compile new functionality. Apparently, the method called is not implemented for the specific
class of the field object.
SEE ALSO
This module is part of the MailTools distribution, http://perl.overmeer.net/mailtools/.
AUTHORS
The MailTools bundle was developed by Graham Barr. Later, Mark Overmeer took over maintenance without commitment to further development.
Mail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by Peter Orbaek <poe@cit.dk>. Mail::Mailer and Mail::Send by Tim Bunce
<Tim.Bunce@ig.co.uk>. For other contributors see ChangeLog.
LICENSE
Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2007 Mark Overmeer <perl@overmeer.net>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See
http://www.perl.com/perl/misc/Artistic.html
perl v5.18.2 2014-01-05 Mail::Field::Date(3)