Full Discussion: Sort based on certain value in a column
Sort based on certain value in a column Post 302899975 by redse171 on Friday 2nd of May 2014 04:29:15 PM
Hi jim mcnamara,

I just edited the filename in my question above as it seems confusing. Ok, the sample input is "input1.txt" and the sample output is "output.txt". Thanks
 redse171 View Public Profile for redse171 Find all posts by redse171
Test Your Knowledge in Computers #796
Difficulty: Medium
Fractions in binary arithmetic terminate only if 2 is the only prime factor in the denominator.
True or False?

## Question about sort specific column and print other column at the same time !

Hi, This is my input file: ali 5 usa abc abu 4 uk bca alan 6 brazil bac pinky 10 utah sdc My desired output: pinky 10 utah sdc alan 6 brazil bac ali 5 usa abc abu 4 uk bca Based on the column two, I want to do the descending order and print out other related column at the...

## sort on second column only based on first column

I have an input file like this... AAAlkalines Energizer AAAlkalines Energizer AAAlkalines Energizer AAAlkalines Sunlight AAAlkalines Sunlight AAAlkalines Sunlight AAAlkalines Energizer AAAlkalines Energizer AAAlkalines Energizer AAASalines ...

## Sort file based on column

Hi, My input file is \$cat samp 1 siva 1 raja 2 siva 1 siva 2 raja 4 venkat i want sort this name wise...alos need to remove duplicate lines. i am using cat samp|awk '{print \$2,\$1}'|sort -u it showing raja 1

## How to sort a column based on numerical ascending order if it includes e-10?

I have a column of numbers in the following format: 1.722e-05 2.018e-05 2.548e-05 2.747e-05 7.897e-05 4.016e-05 4.613e-05 4.613e-05 5.151e-05 5.151e-05 5.151e-05 6.1e-05 6.254e-05 7.04e-05 7.12e-05 7.12e-05

## Sort command in one column and not effect to another column

If my data is numerical : 1 = 101 2 = 102 3 = 104 4 = 104 7 = 103 8 = 103 9 = 105 I need the result like below: 1 = 101 2 = 102 3 = 103 4 = 103 7 = 104 8 = 104 9 = 105

## Sort based on column 1, not working with awk

Hi Guru, I need some help regarding awking the output so it only show the first line (based on column) of each row. So If column has 1, three row, then it only show the first line of that row, based on similar character in column 1. So i am trying to achieve a sort, based on column one and...

## Sum column values based in common identifier in 1st column.

Hi, I have a table to be imported for R as matrix or data.frame but I first need to edit it because I've got several lines with the same identifier (1st column), so I want to sum the each column (2nd -nth) of each identifier (1st column) The input is for example, after sorted: K00001 1 1 4 3...

## How to align/sort the column pairs of an csv file, based on keyword word specified in another file?

I have a csv file as shown below, xop_thy 80 avr_njk 50 str_nyu 60 avr_irt 70 str_nhj 60 avr_ngt 50 str_tgt 80 xop_nmg 50 xop_nth 40 cyv_gty 40 cop_thl 40 vir_tyk 80 vir_plo 20 vir_thk 40 ijk_yuc 70 cop_thy 70 ijk_yuc 80 irt_hgt 80 I need to align/sort the csv file based...

## Use sort to sort numerical column

How to sort the following output based on lowest to highest BE? The following sort does not work. \$ sort -t. -k1,1n -k2,2n bfd.txt BE31.116 0s 0s DOWN DAMP BE31.116 0s 0s DOWN DAMP BE31.117 0s 0s ...

## Sort based on one column

Hi All , I am having an input file like this Input file 7 sks/jsjssj/ddjd/hjdjd/hdhd/Q 10 0.5 13 dkdkd/djdjd/djdjd/djd/QB 01 0.5 ldld/dkd/jdf/fjfjf/fjf/Q 0.5 10 sjs/jsdd/djdkd/dhd/Q 01 0.5 21 kdkd/djdd/djdd/jdd/djd/QB 01 0.5 dkdld/djdjd/djd/Q 01 0.5 ...
```DCSORT(1)					      DICOM PS3 - Make sorted list of images						 DCSORT(1)

NAME
dcsort - ACR/NEMA DICOM PS3 ... DICOM PS3 - Make sorted list of images

SYNOPSIS
dcsort  "  inputfile1  [ inputfile2 ... ]" [ -v|verbose ] [ -vv|veryverbose ] [ -vvv|veryveryverbose ] [ -index ] [ -show ] [ -interval ] [
-tolerance mm ] [ -check ] [ -checkFoR ] [ -descending ] [ -sortby|k  attributename ]

DESCRIPTION
dcsort reads the named dicom input files and sorts them by the specified sort key.

The sort key should be a single valued numeric attribute, with the exception of ImageOrientationPatient and ImagePositionPatient which  are
handled as special cases.

There is no output by default unless the index or verbose options are specified.

OPTIONS
The output and errors go to standard error.

The basic input switches are described in dcintro(1). Options specific to this program are:

-index
Creates a first column of output that is the index in the sort order, starting from 0, and a second column that is the filename.

-show
Show the value of the sort key after the file name with the -index option

-interval
Show the interval between values of the sort key, or an error if not equal

-tolerance mm
The tolerance value in mm to use when comparing intervals between slices; defaults to +/- 0.01 mm if unspecified

-check
Check that all the images are from the same series.

-checkFoR
Check that all the images have the same Frame of Reference (UID).

-descending
Sort in descending, rather than the default ascending, order.

-sortby|k  attributename
Specify attributename as the sort key.

ENVIRONMENT

EXAMPLES

% dcsort -index -sortby SliceLocation ./1/[0-9]*
0    ./1/1
1    ./1/2

FILES