Sponsored Content
Top Forums Shell Programming and Scripting Sort data by a DDMMYYYY field Post 302228914 by martinezjorge on Monday 25th of August 2008 06:38:52 PM
Old 08-25-2008
Sort data by a DDMMYYYY field

I have a CSV file which I have to sort it by a field with DDMMYYYY format, since I'm not a unix specialist, how is the easiest way to do this?

Sample data
30062008,432120,A,5001,A,201,Z ,2,MXN
31092008,432121,B,4001,B,101,Z ,2,MXN
05112008,432122,C,2001,C,51,Z ,2,MXN
30102008,432124,D,1001,D,31,Z ,2,MXN
20022008,432125,E,601,E,16,Z ,2,MXN
31042008,432126,F,401,F,6,Z ,2,MXN
30072008,432127,G,101,G,1,Z ,2,MXN
07022008,432128,A,5002,A,202,Z ,2,MXN
11012008,432129,B,4002,B,102,Z ,2,MXN
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sort columns by field

hello, i have a table contain many columns delimited by blank. i want to sort this table by the 2 columns and 3 one and i want to keep the first line inchanged? how can i do using the sort command? thanks table like : field1 field2 field3 field4 x y z b t h r n .. (4 Replies)
Discussion started by: kamel.seg
4 Replies

2. Shell Programming and Scripting

Sort alpha on 1st field, numerical on 2nd field (sci notation)

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

3. UNIX for Dummies Questions & Answers

Sort field by date mm/dd/yyyy

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

4. Shell Programming and Scripting

perl sort array by field

Hi Everyone, Any simple code can simplify the code below, please advice. Thanks # cat 2.pl #!/usr/bin/perl use warnings; use strict; my @aaaaa = <DATA>; my @uids; foreach (@aaaaa) { my @ccccc = split (",", $_); push @uids, $ccccc;... (3 Replies)
Discussion started by: jimmy_y
3 Replies

5. UNIX for Advanced & Expert Users

Sort on basis of particular field

05.50.25:AIRE.S:RESTRICTED:S2: 05.50.25:ANDR.VI:RESTRICTED:S2: 05.50.25:BASF.MI:RESTRICTED:N: 05.50.25:BMWG.DE:RESTRICTED:N: 05.50.25:BORE.ST:RESTRICTED:N: I can sort of the basis of second field using " sort -t: -k2,2 " but what i want to sort the data is on the basis its extension e.g.:... (9 Replies)
Discussion started by: manishma71
9 Replies

6. Shell Programming and Scripting

Perl script to sort data on second numeric field

Hi, I'm a learner of PERL programming. I've a input file with the below data: SWAT_5, 1703, 2010-09-21 SWAT_6, 2345, 2010-09-21 SWAT_7, 1792, 2010-09-21 SWAT_8, 1662, 2010-09-21 SWAT_9, 1888, 2010-09-21 VXHARP_1, 171, 2010-09-21 I need to sort this data based on the second... (6 Replies)
Discussion started by: ganapati
6 Replies

7. Shell Programming and Scripting

Sort help on non numeric field

Hi, I am unable to sort data on the first field $cat t Jim,212121,Seattle Bill,404404,Seattle Steve,246810,Nevada Scott,212277,LosAngeles Jim,212121,Ohio sort -t"," -k1,2 t Bill,404404,Seattle Jim,212121,Ohio Jim,212121,Seattle Scott,212277,LosAngeles Steve,246810,Nevada (7 Replies)
Discussion started by: Shivdatta
7 Replies

8. Shell Programming and Scripting

Sorting Date Field with Sort -k :/

SOLVED : (17 Replies)
Discussion started by: Glitch100
17 Replies

9. Shell Programming and Scripting

Sort field and uniq

I have a flatfile A.txt 2012/12/04 14:06:07 |trees|Boards 2, 3|denver|mekong|mekong12 2012/12/04 17:07:22 |trees|Boards 2, 3|denver|mekong|mekong12 2012/12/04 17:13:27 |trees|Boards 2, 3|denver|mekong|mekong12 2012/12/04 14:07:39 |rain|Boards 1|tampa|merced|merced11 How do i sort and get... (3 Replies)
Discussion started by: sabercats
3 Replies
BIB-1 ATTRIBUTE SET(7)					   Conventions and miscellaneous				    BIB-1 ATTRIBUTE SET(7)

NAME
bib1-attr - Bib-1 Attribute Set DESCRIPTION
This reference entry lists the Bib-1 attribute set types and values. TYPES
The Bib-1 attribute defines six attribute types: Use (1), Relation (2), Position (3), Structure (4), Truncation (5) and completeness (6). USE (1) 1 Personal-name 2 Corporate-name 3 Conference-name 4 Title 5 Title-series 6 Title-uniform 7 ISBN 8 ISSN 9 LC-card-number 10 BNB-card-number 11 BGF-number 12 Local-number 13 Dewey-classification 14 UDC-classification 15 Bliss-classification 16 LC-call-number 17 NLM-call-number 18 NAL-call-number 19 MOS-call-number 20 Local-classification 21 Subject-heading 22 Subject-Rameau 23 BDI-index-subject 24 INSPEC-subject 25 MESH-subject 26 PA-subject 27 LC-subject-heading 28 RVM-subject-heading 29 Local-subject-index 30 Date 31 Date-of-publication 32 Date-of-acquisition 33 Title-key 34 Title-collective 35 Title-parallel 36 Title-cover 37 Title-added-title-page 38 Title-caption 39 Title-running 40 Title-spine 41 Title-other-variant 42 Title-former 43 Title-abbreviated 44 Title-expanded 45 Subject-precis 46 Subject-rswk 47 Subject-subdivision 48 Number-natl-biblio 49 Number-legal-deposit 50 Number-govt-pub 51 Number-music-publisher 52 Number-db 53 Number-local-call 54 Code-language 55 Code-geographic 56 Code-institution 57 Name-and-title 58 Name-geographic 59 Place-publication 60 CODEN 61 Microform-generation 62 Abstract 63 Note 1000 Author-title 1001 Record-type 1002 Name 1003 Author 1004 Author-name-personal 1005 Author-name-corporate 1006 Author-name-conference 1007 Identifier-standard 1008 Subject-LC-childrens 1009 Subject-name-personal 1010 Body-of-text 1011 Date/time-added-to-db 1012 Date/time-last-modified 1013 Authority/format-id 1014 Concept-text 1015 Concept-reference 1016 Any 1017 Server-choice 1018 Publisher 1019 Record-source 1020 Editor 1021 Bib-level 1022 Geographic-class 1023 Indexed-by 1024 Map-scale 1025 Music-key 1026 Related-periodical 1027 Report-number 1028 Stock-number 1030 Thematic-number 1031 Material-type 1032 Doc-id 1033 Host-item 1034 Content-type 1035 Anywhere 1036 Author-Title-Subject RELATION (2) 1 Less than 2 Less than or equal 3 Equal 4 Greater or equal 5 Greater than 6 Not equal 100 Phonetic 101 Stem 102 Relevance 103 AlwaysMatches POSITION (3) 1 First in field 2 First in subfield 3 Any position in field STRUCTURE (4) 1 Phrase 2 Word 3 Key 4 Year 5 Date (normalized) 6 Word list 100 Date (un-normalized) 101 Name (normalized) 102 Name (un-normalized) 103 Structure 104 Urx 105 Free-form-text 106 Document-text 107 Local-number 108 String 109 Numeric-string TRUNCATION (5) 1 Right truncation 2 Left truncation 3 Left and right truncation 100 Do not truncate 101 Process # in search term . regular #=.* 102 RegExpr-1 103 RegExpr-2 104 Process # ?n . regular: #=., ?n=.{0,n} or ?=.* Z39.58 Thw 105-106 truncation attributes below are only supported by Index Data's Zebra server. 105 Process * ! regular: *=.*, !=. and right truncate 106 Process * ! regular: *=.*, !=. COMPLETENSS (6) 1 Incomplete subfield 2 Complete subfield 3 Complete field SORTING (7) 1 ascending 2 descending Type 7 is an Index Data extension to RPN queries that allows embedding a sort critieria into a query. SEE ALSO
Bib-1 Attribute Set[1] Attibute Set Bib-1 Semantics[2]. NOTES
1. Bib-1 Attribute Set http://www.loc.gov/z3950/agency/defns/bib1.html 2. Attibute Set Bib-1 Semantics http://www.loc.gov/z3950/agency/bib1.html YAZ 4.2.30 04/16/2012 BIB-1 ATTRIBUTE SET(7)
All times are GMT -4. The time now is 04:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy