04-12-2002
sort fields
I have a large csv file that looks like this:
14 ,M0081,+000000001,200302,+00000100500,
14 ,M0081,+000000004,200301,+00000100500,
14 ,M0081,+000000005,200305,+00000100500,
14 ,M0081,+000000000,200205,+00000100500,
14 ,M0081,+000000008,200204,+00000100500,
I need to sort on the first, second and fourth fields so that it would look like this:
14 ,M0081,+000000008,200204,+00000100500,
14 ,M0081,+000000000,200205,+00000100500,
14 ,M0081,+000000004,200301,+00000100500,
14 ,M0081,+000000001,200302,+00000100500,
14 ,M0081,+000000005,200305,+00000100500,
I'm looking at sort -k but haven't got it yet
Thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
HI ALL,
i have a problem when i do a sort sum with many fields.
Is there a limit for fields?
Do you know a solution?
thanks in advance.
the shell is:
# SORT1
SORT1_rcode=777
if ; then
echo "USE $DARSEQ/OTPU.FTPEPREC RECORD F,1000 " > $DARPARSRT/TPEKL508.SORT1_$$.srt
... (6 Replies)
Discussion started by: tullo
6 Replies
2. Shell Programming and Scripting
Hi I have following fixed width file and I have to sort on 2 fields
ABC 111222333002555 77788
ABC 111222333004555 77788
ABC 111222333001555 77788
ABC 111222333003555 77788
ABC 111222333005555 77788
one is from field1 to field 3 "ABC" and another is on 14 to 16 "002" (based on first... (1 Reply)
Discussion started by: mgirinath
1 Replies
3. Shell Programming and Scripting
Hi experts,
I am trying sort command with my data but still not getting the expected results.
For example, I have 5 fields data here
c,18:12:45,c,c,c
d,12:34:34,d,d,d
a,13:50:10,a,a,a
b,13:50:50,b,b,b
a,13:50:50,a,a,a
b,14:10:01,b,b,b
c,10:12:45,c,c,c
I want to get
... (3 Replies)
Discussion started by: lalelle
3 Replies
4. UNIX for Dummies Questions & Answers
Hi I would like to sort a csv file. It has 50 fields and approx 1400000 lines. I want to sort by three columns as follows. Say sort on coulmn 5, if entries are equal sort on column 3 if this is also equal sort on column 6.
It seems that this is possible for 5 then 3 i.e.
sort -t "," -k 5,5 -k... (1 Reply)
Discussion started by: turquoise_man
1 Replies
5. UNIX for Dummies Questions & Answers
Hey,
I have a file i want to sort. It contains these kind of lines:
FirstName LastName buyID buyType
Eg:
John Doe 22 Car
Jane Simpson 4 Headset
John Doe 11 Telephone
Now if I use the sort command on it
cat purchases.txt | sort -k1,1 -k2,2
it would also sort the third and 4th field:... (4 Replies)
Discussion started by: ce3c
4 Replies
6. Shell Programming and Scripting
I have a file with contents below
123,502
123,506
123,702
234,101
235,104
456,104
456,100
i want to sort such that i get a unique value in column A, and for those with multiple value in A, i want the lowest value in B.
output should be
123,502
234,101
235,104
456,100 (3 Replies)
Discussion started by: dealerso
3 Replies
7. Shell Programming and Scripting
I have another file with three columns A,B,C as below
123,1,502
123,2,506
123,3,702
234,4,101
235,5,104
456,6,104
456,7,100
i want to sort such that i get a unique value in column A, and for those with multiple value in A, i want the lowest value in C.
output should be
Code:... (3 Replies)
Discussion started by: dealerso
3 Replies
8. Shell Programming and Scripting
hi,
i'm having a file stg_ff.txt
which contains 10 fields,which contains millions of records
i need to cat the first 10 rows in the file after doing a sorting on the first two fields i n the file.
can any body help me on this.
regards
Angel (4 Replies)
Discussion started by: angel12345
4 Replies
9. Shell Programming and Scripting
Please advice in this.
Input file
100,vvvt
201,unb
100,sos
301,abc
99,gang
desired output
99,gang
100,vvvt
100,sos
201,unb
301,abc
Means if first fields are same ( here 100) the do not sort. (4 Replies)
Discussion started by: theshashi
4 Replies
10. Shell Programming and Scripting
Hi
I have a file as below
<field1> <field2> <field3> ... <field_num1> <field_num2>
Trying to sort based on difference of <field_num1> and <field_num2> in desceding order and print all fields.
I tried this and it doesn't sort on the difference field .. Appreciate your help.
cat... (9 Replies)
Discussion started by: newstart
9 Replies
LEARN ABOUT DEBIAN
amc-export
AMC-EXPORT(1) Auto Multiple Choice AMC-EXPORT(1)
NAME
AMC-export - exports marks for AMC multiple choice exams.
SYNOPSIS
auto-multiple-choice export --data project-data-dir --module module --fich-noms students-list.csv [--noms-encodage list-encoding]
--o output-file
DESCRIPTION
The AMC-export.pl command exports marks from an Auto Multiple Choice exam.
--data project-data-dir
gives the directory where data files are (see for example AMC-prepare(1)).
--module module
selects a module for export. See below for the modules included in the AMC standard distribution.
--fich-noms students-list.csv
sets the students list file.
--noms-encodage list-encoding
selects an encoding for file students-list.csv (default is utf-8).
--o output-file
gives the output file name.
--option-out options
gives an option for selected module, in the form key=value (see below for possible options for each module). To specify multiple
options, use --option several times.
--sort sort-type
sort the students names, depending on sort-type. If sort-type is l, use line number from students list file to sort. If sort-type is m,
use mark (and name if marks are equal) to sort. If sort-type is i, use student number to sort. If sort-type is n, use name to sort (or
line from students list if equal).
--useall all
if all is 0 or empty, only students with a scaned answer sheet appears in the output. If all is 1, all students in the students list
appears in the output.
MODULES
OpenDocument
With "--module ods", an OpenDocument (for use by OpenOffice or LibreOffice for example) is produced. The following options are recognized:
nom
gives a name for the exam, to be written on the beginning of the sheet.
code
gives an short name for the exam, to be used as a tab name.
columns
sets the list of columns that are to be added to each student. Default value is student.key,student.name.
stats
with a true value, a table will be added with statistics for all questions.
statsindic
with a true value, a table will be added with statistics for all indicative questions.
CSV
With "--module CSV", a CSV file is produced. The following options are recognized:
columns
sets the list of columns that are to be added to each student. Default value is student.copy,student.key,student.name.
decimal
sets the decimal point (default is a dot).
encodage
sets the encoding to use for output (default is utf-8).
separateur
sets the character used between colums (default is a comma).
entoure
sets the character used to enclose strings (default is a double quote).
ticked
if not empty, additional columns (with "CHECKED:" prefix) are included to give all the checked boxes on all the sheets. This can be
used by an external program to retrieve all the checked boxes when marks are not sufficient. Use value 01 to get 0;0;1;1;0 if boxes 3
and 4 are checked, and value AB to get CD if boxes 3 and 4 are checked.
List
With "--module List", a PDF file is produced with a list of marks for all students. The following options are recognized:
pagesize
The page size. Default value is a4.
nom
gives the name of the exam, to be printed at the top of the page.
ncols
The number of columns. Default value is 2.
decimal
sets the decimal point (default is a dot).
AUTHORS
Alexis Bienvenue <paamc@passoire.fr>
Main author
Jean Berard
Translation from French
Georges Khaznadar
Translation from French
COPYRIGHT
Copyright (C) 2008-2012 Alexis Bienvenue
This document can be used according to the terms of the GNU General Public License, version 2 or later.
Auto Multiple Choice 1.1.1 06/19/2012 AMC-EXPORT(1)