03-29-2001
Quote:
but this will sort all dates with a common month together?
No. At least not in my version of sort. Check the man page if you need more details.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi at all,
I have to sort a log file on timestamp field. That's field is the third!
a log file sample.....
1|EVTVOD-1-20060709_000614|2006/07/09-0:11:23|0.3.8
1|EVTVOD-1-20060709_000614|2006/07/09-0:11:16|0.3.8
1|EVTVOD-1-20060709_000614|2006/07/09-0:11:20|0.3.8... (3 Replies)
Discussion started by: nmilella
3 Replies
2. Shell Programming and Scripting
Hi All,
I have a file say abc.txt with the below data.
1234 876S 01Mar2007 foo
1244 65DF 19Jan2007 boo
9924 234K 01Jan2006 koo
8866 8FGH 12Feb1999 roo
7777 ASDF 13May2007 soo
I need this file to be in sorted order depending on the date field.
e.g
8866 8FGH 12Feb1999 roo... (2 Replies)
Discussion started by: rinku11
2 Replies
3. Shell Programming and Scripting
Hi,
I have a list of files that take on the format ABCDE_yymmdd and wish to sort them in ascending date order. I can't use the unix time stamp for the file as this could possibly be different from the date given in the file name.
Does anyone know of any way this can be done using unix shell... (14 Replies)
Discussion started by: LiquidChild
14 Replies
4. UNIX for Dummies Questions & Answers
Hi guys... I've been trying to do this for ages. Maybe you can help.
I have log files like the examples below and I have grepped out certain lines from the files so that I can get an idea of who is logging on and how. So now I have the information in a new file but it is now in a different order... (7 Replies)
Discussion started by: padmundo
7 Replies
5. Shell Programming and Scripting
Hi Guys!
i have a problem of sorting column chronologically because the data i have in column is in the following format
06/Dec/2006:18:09:54
and need to be sorted in the following way (upto seconds)
06/Dec/2005:18:09:50
06/Dec/2005:18:09:51
31/Mar/2006:19:30:41
24/Oct/2006:19:16:19... (4 Replies)
Discussion started by: me_newbie
4 Replies
6. Shell Programming and Scripting
input :
20110730
20110730
20110731
20110731
20110801
20110801
20110801
20110813
20110815
01062011
01062011
OUTPUT : i need to sort this input in such a way so that the latest date comes first. (11 Replies)
Discussion started by: urfrnddpk
11 Replies
7. Shell Programming and Scripting
Hi,
PFB the data:
C_Random_130417
Java_Random_130518
Perl_Random_120519
Perl_Random_120528
so the values are ending with year,i.e.,130417
i want to sort the values with date.
i want the output like this:
Perl_Random_120519
Perl_Random_120528
C_Random_130417
Java_Random_130518
can... (5 Replies)
Discussion started by: arindam guha
5 Replies
8. Shell Programming and Scripting
I am trying to sort by two columns. The first column in an ID, the second is a date in the form yyyy-mm-dd. I need to sort by the ID column, then in ascending order for the date column (earliest date to most recent date compared to today).
Input data:
012-abc 2012-04-25 ... (3 Replies)
Discussion started by: mollydog11
3 Replies
9. Shell Programming and Scripting
I have file data.txt having below data
cat data.txt
01-MAY-13 2.38.11.00.100089 IN 4512 0000741881
01-MAY-13 2.38.11.00.100089 IN 4512 0000741881
01-JUN-13 2.38.11.00.100089 FC 1514 0000764631
01-NOV-13 2.38.11.00.100089 FC 1514 0000856571
01-NOV-13 2.38.11.00.100089 IN 300.32... (1 Reply)
Discussion started by: ranabhavish
1 Replies
10. UNIX for Dummies Questions & Answers
Hi all,
I have a file with a list of rpm's that have different dates. I am trying to just grab the latest rpm and install date, and discard the rest. The file has 1000's of entries all with different names and dates.
I have tried sort -k on the file and I am not grabbing the info,
... (4 Replies)
Discussion started by: gartie
4 Replies
SORTM(1) [nmh-1.5] SORTM(1)
NAME
sortm - sort messages
SYNOPSIS
sortm [+folder] [msgs] [-datefield field] [-textfield field] [-notextfield] [-limit days] [-nolimit] [-verbose | -noverbose] [-version]
[-help]
DESCRIPTION
Sortm sorts the specified messages in the named folder according to the chronological order of the "Date:" field of each message.
The -verbose switch directs sortm to tell the user the general actions that it is taking to place the folder in sorted order.
The -datefield field switch tells sortm the name of the field to use when making the date comparison. If the user has a special field in
each message, such as "BB-Posted:" or "Delivery-Date:", then the -datefield switch can be used to direct sortm which field to examine.
The -textfield field switch causes sortm to sort messages by the specified text field. If this field is "subject", any leading "re:" is
stripped off. In any case, all characters except letters and numbers are stripped and the resulting strings are sorted datefield-major,
textfield-minor, using a case insensitive comparison.
With -textfield field, if -limit days is specified, messages with similar textfields that are dated within `days' of each other appear
together. Specifying -nolimit makes the limit infinity. With -limit 0, the sort is instead made textfield-major, date-minor.
For example, to order a folder by date-major, subject-minor, use:
sortm -textfield subject +folder
FILES
$HOME/.mh_profile The user profile
PROFILE COMPONENTS
Path: To determine the user's nmh directory
Current-Folder: To find the default current folder
SEE ALSO
folder(1)
DEFAULTS
`+folder' defaults to the current folder
`msgs"'defaultstoall"
`-datefield' defaults to date
`-notextfield'
`-noverbose'
`-nolimit'
CONTEXT
If a folder is given, it will become the current folder. If the current message is moved, sortm
will preserve its status as current.
HISTORY
Timezones used to be ignored when comparing dates: they aren't any more.
Messages which were in the folder, but not specified by `msgs', used to be moved to the end of the folder; now such messages are left
untouched.
Sortm sometimes did not preserve the message numbering in a folder (e.g., messages 1, 3, and 5, might have been renumbered to 1, 2, 3 after
sorting). This was a bug, and has been fixed. To compress the message numbering in a folder, use "folder -pack" as always.
BUGS
If sortm encounters a message without a date-field, or if the message has a date-field that sortm cannot parse, then sortm attempts to keep
the message in the same relative position. This does not always work. For instance, if the first message encountered lacks a date which
can be parsed, then it will usually be placed at the end of the messages being sorted.
When sortm complains about a message which it can't temporally order, it complains about the message number prior to sorting. It should
indicate what the message number will be after sorting.
MH.6.8 11 June 2012 SORTM(1)