Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Sort each column independently Post 302894499 by a_bahreini on Tuesday 25th of March 2014 06:12:50 PM
Old 03-25-2014
Sorry if I didn't explain enough. My file has 41 fields and 60 rows. I have only inputed two rows and two columns in my last post. I don't want to sort based on a particular field but I'd like to sort each column by itself based on the number after third vertical bar on that column. I just wanted 41 sorted columns in my output. I'm using linux.
I'm sorry but I don't know how to get the maximum line length (in bytes) for my input file
Hope this helps

---------- Post updated at 06:12 PM ---------- Previous update was at 05:53 PM ----------

Thanks Spacebar for the links but I've checked those out! I don't want to sort the whole file based on any particular columns. All I need is to sort each column by its own as I explained in my last post. "sort" command only sorts based on specific columns.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sort a particular column in a file

Dear All, Good day. Here i am facing some problem like below. file contains 12345 0001 090112 14385 0001 090112 13255 0001 090112 11345 0001 090112 .... I want to sort ascending according to the first column. What will be the shell script. (4 Replies)
Discussion started by: saifurshaon
4 Replies

2. Shell Programming and Scripting

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... (3 Replies)
Discussion started by: patrick87
3 Replies

3. Shell Programming and Scripting

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 ... (7 Replies)
Discussion started by: malcomex999
7 Replies

4. UNIX for Dummies Questions & Answers

Sort on one column only

Hello, I am running on AIX.I have a question about sorting in UNIX. if my file is something like this: a c b d a b b c a a I want to sort on column 1 only. The following statement does not seem to work, it still considers the rest of the line in the sorting results: sort... (2 Replies)
Discussion started by: gio001
2 Replies

5. Shell Programming and Scripting

Sort data As per first Column

hI I have file A NSU30504 5 6 G 6 NSU3050B T 7 9 J NSU30506 T I 8 9 NSU3050C H J K L Output: NSU3050B T 7 9 J NSU3050C H J K L NSU30504 5 6 G 6 NSU30506 T I 8 9Video tutorial on how to use code tags in The UNIX and Linux Forums. (13 Replies)
Discussion started by: pareshkp
13 Replies

6. UNIX for Dummies Questions & Answers

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 (4 Replies)
Discussion started by: GeodusT
4 Replies

7. Shell Programming and Scripting

How to execute same script independently?

Hello All, I have one script for example a1.sh. I want to execute the same a1.sh script inside a1.sh script at the end with different parameter such that the second one will run independently. I don't want the second one to take any input from 1st a1.sh. I tried few things like background/exec... (7 Replies)
Discussion started by: Vikram_Tanwar12
7 Replies

8. Shell Programming and Scripting

Sort on column

How to sort based on the 4 the column . The input data has a header and output needs to be sorted based on the 4th column rbcid. I tried below code but not getting results sort -u -t'|' -k4,4r file1 > file2 time|tourit|nofdays|rbcid|blank|type|value|nill|valuedesc|name... (6 Replies)
Discussion started by: samrat dutta
6 Replies

9. UNIX for Dummies Questions & Answers

Custom sort on a column

Hello all, How do I achieve this? I have A, B and A/B in different variables in a file in col2. I want them to sort in such a way, that the variables appear together, and within a variable, the data is sorted in the order A,B and then A/B. If I sort on the second column, the order becomes A,... (6 Replies)
Discussion started by: senhia83
6 Replies

10. Shell Programming and Scripting

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 ... (7 Replies)
Discussion started by: sand1234
7 Replies
PVS(8)							      System Manager's Manual							    PVS(8)

NAME
pvs - report information about physical volumes SYNOPSIS
pvs [--aligned] [-d|--debug] [-h|-?|--help] [--ignorelockingfailure] [--nameprefixes] [--noheadings] [--nosuffix] [-o|--options [+]Field[,Field]] [-O|--sort [+|-]Key1[,[+|-]Key2[,...]]] [--rows] [--segments] [--separator Separator] [--unbuffered] [--units hsbkmgtHK- MGT] [--unquoted] [-v|--verbose] [--version] [PhysicalVolume [PhysicalVolume...]] DESCRIPTION
pvs produces formatted output about physical volumes. OPTIONS
See lvm for common options. --aligned Use with --separator to align the output columns. --nameprefixes Add an "LVM2_" prefix plus the field name to the output. Useful with --noheadings to produce a list of field=value pairs that can be used to set environment variables (for example, in udev (7) rules). --noheadings Suppress the headings line that is normally the first line of output. Useful if grepping the output. --nosuffix Suppress the suffix on output sizes. Use with --units (except h and H) if processing the output. -o, --options Comma-separated ordered list of columns. Precede the list with '+' to append to the default selection of columns. Column names are: pv_fmt, pv_uuid, pv_size, dev_size, pv_free, pv_used, pv_name, pv_attr, pv_pe_count, pv_pe_alloc_count, pv_tags, pvseg_start, pvseg_size, pe_start, pv_mda_count, pv_mda_free, and pv_mda_size. With --segments, any "pvseg_" prefixes are optional; otherwise any "pv_" prefixes are optional. Columns mentioned in vgs (8) can also be chosen. The pv_attr bits are: (a)llocatable and e(x)ported. Use -o help to view the full list of fields available. --segments Produces one line of output for each contiguous allocation of space on each Physical Volume, showing the start (pvseg_start) and length (pvseg_size) in units of physical extents. -O, --sort Comma-separated ordered list of columns to sort by. Replaces the default selection. Precede any column with - for a reverse sort on that column. --rows Output columns as rows. --separator Separator String to use to separate each column. Useful if grepping the output. --unbuffered Produce output immediately without sorting or aligning the columns properly. --units hsbkmgtHKMGT All sizes are output in these units: (h)uman-readable, (s)ectors, (b)ytes, (k)ilobytes, (m)egabytes, (g)igabytes, (t)erabytes. Cap- italise to use multiples of 1000 (S.I.) instead of 1024. Can also specify custom (u)nits e.g. --units 3M --unquoted When used with --nameprefixes, output values in the field=value pairs are not quoted. SEE ALSO
lvm(8), pvdisplay(8), lvs(8), vgs(8) Sistina Software UK LVM TOOLS 2.02.44-cvs (02-17-09) PVS(8)
All times are GMT -4. The time now is 02:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy