Sponsored Content
Full Discussion: how to sort a file
Top Forums UNIX for Dummies Questions & Answers how to sort a file Post 18079 by thehoghunter on Saturday 23rd of March 2002 03:36:36 AM
Old 03-23-2002
Check out the sort command ( $ man sort ) - especially the sort key options. You can sort on position or on a character separator. Multiple keys are allowed but this would take some thinking to get the order correct.
thehoghunter
 

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

Need to sort file

Hi, I have a file with the list of RPMs in the following format unix-abc-bin-1.27.1-006901 unix-abc-cfg-1.27.1-006901 unix-xyz-bin-1.27.1-006901 unix-abc-bin-1.27.2-006902 unix-xyz-bin-1.27.2-006902 unix-xyz-img-1.27.2-006902 I need the output as shown below unix-abc-bin-1.27.2-006902... (4 Replies)
Discussion started by: learnerlearner
4 Replies

3. Shell Programming and Scripting

q's on file sort

I have a file below which has a list of users and roles with each row having unique combination of users and roles. USER1 ROLE1 USER1 ROLE2 USER2 USER3 ROLE1 USER3 ROLE2 USER3 ROLE3 USER4 ROLE2 .... .... I am trying to create a script which sorts the above file to have all the... (4 Replies)
Discussion started by: stevefox
4 Replies

4. Shell Programming and Scripting

How to Sort Floating Numbers Using the Sort Command?

Hi to all. I'm trying to sort this with the Unix command sort. user1:12345678:3.5:2.5:8:1:2:3 user2:12345679:4.5:3.5:8:1:3:2 user3:12345687:5.5:2.5:6:1:3:2 user4:12345670:5.5:2.5:5:3:2:1 user5:12345671:2.5:5.5:7:2:3:1 I need to get this: user3:12345687:5.5:2.5:6:1:3:2... (7 Replies)
Discussion started by: daniel.gbaena
7 Replies

5. UNIX for Advanced & Expert Users

Script to sort the files and append the extension .sort to the sorted version of the file

Hello all - I am to this forum and fairly new in learning unix and finding some difficulty in preparing a small shell script. I am trying to make script to sort all the files given by user as input (either the exact full name of the file or say the files matching the criteria like all files... (3 Replies)
Discussion started by: pankaj80
3 Replies

6. Shell Programming and Scripting

Unix Scripting : Sort a Portion of a File and not the complete file

Need to sort a portion of a file in a Alphabetical Order. Example : The user adam is not sorted and the user should get sorted. I don't want the complete file to get sorted. Currently All_users.txt contains the following lines. ############## # ARS USERS ############## mike, Mike... (6 Replies)
Discussion started by: evrurs
6 Replies

7. Shell Programming and Scripting

Help with sort word and general numeric sort at the same time

Input file: 100%ABC2 3.44E-12 USA A2M%H02579 0E0 UK 100%ABC2 5.34E-8 UK 100%ABC2 3.25E-12 USA A2M%H02579 5E-45 UK Output file: 100%ABC2 3.44E-12 USA 100%ABC2 3.25E-12 USA 100%ABC2 5.34E-8 UK A2M%H02579 0E0 UK A2M%H02579 5E-45 UK Code try: sort -k1,1 -g -k2 -r input.txt... (2 Replies)
Discussion started by: perl_beginner
2 Replies

8. Shell Programming and Scripting

Sort help: How to sort collected 'file list' by date stamp :

Hi Experts, I have a filelist collected from another server , now want to sort the output using date/time stamp filed. - Filed 6, 7,8 are showing the date/time/stamp. Here is the input: #---------------------------------------------------------------------- -rw------- 1 root ... (3 Replies)
Discussion started by: rveri
3 Replies

9. AIX

Sort file

as friends can only Sort this file with awk from low to high from position 3 to 9 bone this: 0003344 A70003344prueba1 A70003347prueba1 A70003345prueba1 A70003349prueba1 A70003343prueba1 A70003342prueba1 (4 Replies)
Discussion started by: tricampeon81
4 Replies

10. UNIX for Beginners Questions & Answers

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... (7 Replies)
Discussion started by: dineshkumarsrk
7 Replies
ppmhist(1)						      General Commands Manual							ppmhist(1)

NAME
ppmhist - print a histogram of a portable pixmap SYNOPSIS
ppmhist [-hexcolor] [-noheader] [-map] [-nomap] [-sort={frequency,rgb}] [ppmfile] DESCRIPTION
Reads a PPM image as input. Generates a histogram of the colors in the image, i.e. a list of all the colors and how many pixels of each color are in the image. OPTIONS
-sort={frequency,rgb} The -sort option determines the order in which the colors are listed in the output. frequency means to list them in order of how pixels in the input image have the color, with the most represented colors first. rgb means to sort them first by the intensity of the red component of the color, the of the green, then of the blue, with the least intense first. The default is frequency. -hexcolor Print the color components in hexadecimal. Default is decimal. -noheader Do not print the column headings. -map Generates a PPM file of the colormap for the image, with the color histogram as comments. -nomap Generates the histogram for human reading. This is the default. SEE ALSO
ppm(5), pgmhist(1), ppmtomap(1), pnmhistmap(1), ppmchange(1) AUTHOR
Copyright (C) 1989 by Jef Poskanzer. 17 September 2000 ppmhist(1)
All times are GMT -4. The time now is 10:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy