11-10-2009
How can you be so sure it didnt do the sort?
Read carefully the man pages of sort again...
sort <filename> will not replace your file by a new one sith sorted lines...
clue:
Quote:
sort(1) sort(1)
-o output The argument given is the name of an output file to
use instead of the standard output. This file can be
the same as one of the input files.
Where do you think the sort went in your command?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have a shell scripting. This will take 7 digit number in each line and add 7 digit number with next subsequent lines ( normal addition ).
Eg:
0000001
0000220
0001235
0000022
0000023
...........
.........
........
Like this i am having around 1500000 records. After adding... (23 Replies)
Discussion started by: thambi
23 Replies
2. Shell Programming and Scripting
Hi ....
iam having a file with 20,000 rows and 56 colums.
Iam trying to sort a file ....for that iam using 'sort' command.
If iam having 3 and 5 key colums etc ... as numerical this 'sort' command will work? what ihave to do ?
sample example :
E100|0|19940102|1|11111|E003... (3 Replies)
Discussion started by: satyam_sat
3 Replies
3. Shell Programming and Scripting
Hi Guys,
I am very new to Unix.Can anyone tell me how to sort a file based on fields.
For example, I am having a file whose contents are mentioned below:
2233|charles harris |g.m. |sales |12/12/52| 90000 9876|bill johnson |director... (3 Replies)
Discussion started by: mraghunandanan
3 Replies
4. Shell Programming and Scripting
I've been on holiday, and the brain's clearly not back in gear yet...
On Solaris, I have a simple list of package names...
DGBUpPost1.43_R1
DGSApp1.44_S1
DGSApp1.47_V1
DGSApp1.48_W0
DGPEuroC1.10_K0
DGPEuroC1.11_L0
DGPEuroC1.9_J0
DGSRet1.10_K0
I just want to properly sort them into... (2 Replies)
Discussion started by: JerryHone
2 Replies
5. Shell Programming and Scripting
Hi All,
My folder contains the files as:
$ ls -lrt
total 50
lms_prap_rf_20100422_99.xml
lms_prap_rf_20100422_9.xml
lms_prap_rf_20100422_100.xml
lms_prap_rf_20100422_10.xml
lms_prap_rf_20100426_1.xml
I need to get the sorting of the above file based on numbers. I need first file in... (5 Replies)
Discussion started by: sreejitnair123
5 Replies
6. UNIX for Advanced & Expert Users
hi everyone, I am kind of new to this forum. I need help in sorting this data out accordingly, I am actually doing a traceroute application and wants my AS path displayed in front of my address like this;
192.168.1.1 AS28513 AS65534 AS5089 AS5089 .... till the last AS number and if possible... (1 Reply)
Discussion started by: sam127
1 Replies
7. Shell Programming and Scripting
I have files with the name
myfile_YYMMDD.txt
I need to sort them by their date stamp. I know this will work.
ls -lrt * | awk '{print $9}' | cut -d "_" -f3 | sort
However, it just returns YYMMDD.txt
I can then append the myfile_ to it. However, that myfile_ may change. How do... (1 Reply)
Discussion started by: guessingo
1 Replies
8. Shell Programming and Scripting
Hello everyone, I'm in need of some assistance. I'm currently enrolled in an introductory UNIX shell programming course and, well halfway through the semester, we are receiving our first actual assignment. I've somewhat realized now that I've fallen behind, and I'm working to get caught up, but for... (1 Reply)
Discussion started by: MrMagoo22
1 Replies
9. Shell Programming and Scripting
Hi All,
I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command.
The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies
10. Shell Programming and Scripting
Hi All,
I am working on a huge pile of data. Its about a service initiating a call and and finishing it.
The columns that I have is:
Date Time URL Call Type ServiceName
5/11/2015 15:00:00 http-/0.0.0.0:8091-9 going to... (3 Replies)
Discussion started by: Junaid Subhani
3 Replies
LEARN ABOUT DEBIAN
xmlsort
XMLSORT(1p) User Contributed Perl Documentation XMLSORT(1p)
NAME
xmlsort - sorts 'records' in XML files
SYNOPSIS
xmlsort -r=<recordname> [ <other options> ] [ <filename> ]
Options:
-r <name> name of the elements to be sorted
-k <keys> child nodes to be used as sort keys
-i ignore case when sorting
-s normalise whitespace when comparing sort keys
-t <dir> buffer records to named directory rather than in memory
-m <bytes> set memory chunk size for disk buffering
-h help - display the full documentation
Example:
xmlsort -r 'person' -k 'lastname;firstname' -i -s in.xml >out.xml
DESCRIPTION
This script takes an XML document either on STDIN or from a named file and writes a sorted version of the file to STDOUT. The "-r" option
should be used to identify 'records' in the document - the bits you want sorted. Elements before and after the records will be unaffected
by the sort.
OPTIONS
Here is a brief summary of the command line options (and the XML::Filter::Sort options which they correspond to). For more details see
XML::Filter::Sort.
-r <recordname> (Record)
The name of the elements to be sorted. This can be a simple element name like 'person' or a pathname like 'employees/person' (only
person elements contained directly within an employees element).
-k <keys> (Keys)
Semicolon separated list of elements (or attributes) within a record which should be used as sort keys. Each key can optionally be
followed by 'alpha' or 'num' to indicate alphanumeric of numeric sorting and 'asc' or 'desc' for ascending or descending order (eg: -k
'lastname;firstname;age,n,d').
-i (IgnoreCase)
This option makes sort comparisons case insensitive.
-s (NormaliseKeySpace)
By default all whitespace in the sort key elements is considered significant. Specifying -s will case leading and trailing whitespace
to be stripped and internal whitespace runs to be collapsed to a single space.
-t <directory> (TempDir)
When sorting large documents, it may be prudent to use disk buffering rather than memory buffering. This option allows you to specify
where temporary files should be written.
-m <bytes> (MaxMem)
If you use the -t option to enable disk buffering, records will be collected in memory in 'chunks' of up to about 10 megabytes before
being sorted and spooled to temporary files. This option allows you to specify a larger chunk size. A suffix of K or M indicates
kilobytes or megabytes respectively.
SEE ALSO
This script uses the following modules:
XML::SAX::ParserFactory
XML::Filter::Sort
XML::SAX::Writer
AUTHOR
Grant McLean <grantm@cpan.org>
COPYRIGHT
Copyright (c) 2002 Grant McLean. All rights reserved. This program is free software; you can redistribute it and/or modify it under the
same terms as Perl itself.
perl v5.12.4 2002-06-14 XMLSORT(1p)