Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Simple sort command

Posted on 2004-11-17
1
Medium Priority
?
335 Views
Last Modified: 2012-05-05
Below is a command
    sort -t: +2n myfile
I know it will sort the 3rd field numerically


Now I have this
    sort -t: +2n -3 myfile
I see this in my textbook but then what is the use? I don't understand :(
0
Comment
Question by:sonic2000
1 Comment
 
LVL 23

Accepted Solution

by:
brettmjohnson earned 200 total points
ID: 12611483
This syntax is used to specify a range of positions on the line.
Specifically, it sorts numerically on the character in position 2.

From the sort man page:

+POS1 [-POS2]
              Specify  a  field within each line to use as a sorting key.  The
              field consists of the portion of the line starting at  POS1  and
              up  to  (but  not  including) POS2 (or to the end of the line if
              POS2 is not given).  The fields and character positions are num-
              bered starting with 0.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question