9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have an input like
220.127.116.11 (5 Replies)
Discussion started by: dnam9917
2. Shell Programming and Scripting
I have a file with the following content:-
181268525,0640613864,X,113,04-jan-2012 14:13:27,... (3 Replies)
Discussion started by: Yoda
3. Shell Programming and Scripting
Hello Everybody :) !!!. i have question in mind, is it possible to sort a list of hexadecimal numbers using "sort" command? (9 Replies)
Discussion started by: Kesavan
4. Homework & Coursework Questions
I have file ipaddress.txt
I want to sort as
So what sort command do I have to use. (1 Reply)
Discussion started by: RiderOnsky
5. Shell Programming and Scripting
Hi to all.
I'm trying to sort this with the Unix command sort.
I need to get this:
user3:12345687:5.5:2.5:6:1:3:2... (7 Replies)
Discussion started by: daniel.gbaena
6. Shell Programming and Scripting
Hi i have a file containing ip addresses and want to sort those IP addresses in the ascending order.
file (match.txt) contents are:
sort -n match.txt
output is :... (3 Replies)
Discussion started by: manmeet
7. UNIX for Dummies Questions & Answers
IŽd like to get a few explanations about how the sort command works when cascading the options.
cscyabl@comet:(develop)> more file
cscyabl@comet:(develop)> sort -n -u file
cscyabl@comet:(develop)> sort -u -n file
10:A1... (8 Replies)
Discussion started by: Indalecio
8. UNIX for Dummies Questions & Answers
I am going to sort a huge flat file using sort command, this file is about 36 million lines, 179 fields delimitered by Ctrl B (002). eg.
I want this file being sorted by the first field, the result is like :
1^B198709........ (2 Replies)
Discussion started by: xli
9. UNIX for Dummies Questions & Answers
Can someone please tell me how to sort a file, based on a particular position within the file?
I have a line sequential file that is 152 bytes per record, in which i need to sort the file based on the numeric data in positions 142-152.
I have done the "man sort" command and see the -k option... (1 Reply)
Discussion started by: rjjenkin
SORT(1) General Commands Manual SORT(1)
sort - sort a file of ASCII lines
sort [-bcdfimnru] [-tc] [-o name] [+pos1] [-pos2] file ...
-b Skip leading blanks when making comparisons
-c Check to see if a file is sorted
-d Dictionary order: ignore punctuation
-f Fold upper case onto lower case
-i Ignore nonASCII characters
-m Merge presorted files
-n Numeric sort order
-o Next argument is output file
-r Reverse the sort order
-t Following character is field separator
-u Unique mode (delete duplicate lines)
sort -nr file # Sort keys numerically, reversed
sort +2 -4 file # Sort using fields 2 and 3 as key
sort +2 -t: -o out # Field separator is :
sort +.3 -.6 # Characters 3 through 5 form the key
Sort sorts one or more files. If no files are specified, stdin is sorted. Output is written on standard output, unless -o is specified.
The options +pos1 -pos2 use only fields pos1 up to but not including pos2 as the sort key, where a field is a string of characters delim-
ited by spaces and tabs, unless a different field delimiter is specified with -t. Both pos1 and pos2 have the form m.n where m tells the
number of fields and n tells the number of characters. Either m or n may be omitted.
comm(1), grep(1), uniq(1).