Sponsored Content
Top Forums Shell Programming and Scripting How to sort multiples clolumns of a file? Post 37529 by thehoghunter on Friday 20th of June 2003 09:30:56 AM
Old 06-20-2003
Are you SURE you want the file to end up that way???

It does not seem like it's sorted. Portions of it are, but then you throw a curve in the middle:

First few lines: Sorted:
GREIMBAJ00;BAN_CAV;Loader.sh;2003/06/13;17:04:04
GREIMBAJ00;BAN_CAV;Loader.sh;2003/06/13;17:04:06
GREIMBAJ00;BAN_PAK;Loader.sh;2003/06/13;17:04:11
GREIMBAJ00;BAN_PAK;Loader.sh;2003/06/13;17:04:18
GREIMBAJ00;PER_COT;Loader.sh;2003/06/13;17:04:16
GREIMBAJ00;PER_COT;Loader.sh;2003/06/13;17:04:21

Next two lines: Not Sorted:
GREIMBAJ00;PER_COT;Traitement.sh;2003/06/13;17:04:25
GREIMBAJ00;PER_COT;Traitement.sh;2003/06/13;17:04:18

Next few lines: Sorted:
GREIMBAJ01;BAN_CAV;Traitement.sh;2003/06/13;17:04:35
GREIMBAJ01;BAN_CAV;Traitement.sh;2003/06/13;17:05:03
GREIMBAJ02;BAN_PAK;Traitement.sh;2003/06/16;09:19:56
GREIMBAJ02;BAN_PAK;Traitement.sh;2003/06/16;09:20:00
GREIMBAJ02;BAN_PAK;Delete.sh;2003/06/16;09:20:03
GREIMBAJ02;BAN_PAK;Delete.sh;2003/06/16;09:20:05
GREIMBAJ04;BAN_LIE;Pretraitement.sh;2003/06/16;09:27:34
GREIMBAJ04;BAN_LIE;Pretraitement.sh;2003/06/16;09:27:37

Next two: Not Sorted:
GREIMBAJ04;BAN_RAV;Traitement.sh;2003/06/16;09:28:23
GREIMBAJ04;BAN_RAV;Traitement.sh;2003/06/16;09:27:39

If you want them sorted - try
$ sort -t\; -k 1,2 -k 3,4 -k 5 inputfile
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Using cp for copying multiples files

Hi all, I've got this question about using cp for copying multiples files from the same source directory to another directory, considering that my working directory ain't the same of the source directory. Let me give you a simple example what I'm talking about: Suppose the following files... (2 Replies)
Discussion started by: chapeupreto
2 Replies

2. Programming

Pointer addresses in multiples of 32 ?

1. Why are the pointers' addresses every 32 ? 2. Am I correct in stating that memset is writing to memory that is not allocated to any of the 3 pointers ? Is it writing to memory in between the pointers ? 3. Are the 3 pointers contiguous in memory ? 4. I only allocated 10 bytes for each pointer.... (5 Replies)
Discussion started by: cyler
5 Replies

3. Shell Programming and Scripting

multiples menu in ksh

Hi, IS possible in ksh to make multiples menus? For example: My menu. 1)Option1 1.1)Option1.1 2.3)Option1.2 2)Option2 2.1)Option2.1 . . . x)Exit I've tried with case but no success. Thanks in advance. (3 Replies)
Discussion started by: iga3725
3 Replies

4. Shell Programming and Scripting

join multiples seds

Hi I have this string with 3 seds.. cat /tmp/roletmp|sed "s/$role2del//" | sed "s/,,/,/" |sed "s/^,//" |sed 's/,$//' How can I join these 3 seds in one? regards Israel. (3 Replies)
Discussion started by: iga3725
3 Replies

5. Programming

multiples of 10 in java

Hi Guys, I wonder how can I determine when a given number is a multiple of another one in java. Let's say if I have 27 how can I determine whether is multiple of 5 using java programming. Thanks. (1 Reply)
Discussion started by: arizah
1 Replies

6. 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

7. Shell Programming and Scripting

awk on multiples files

Ques from newbie I want to total column X from large number of files, and view totals for each file separately with the filename. I have tried: for i in `ls -1 *.pattern`; do cat "$i" | awk '{SUM += $4} END { printf("%8d\t%8d\n", $i,SUM) }'; done does not work. appreciate your help (5 Replies)
Discussion started by: analyst
5 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. UNIX for Dummies Questions & Answers

Separate file into multiples Linux

Hi guys I am newbie in using linux, how can i Separate file into multiples linux. I want the lines with same parent and id numbers print out into same files. For example Gm17 5135289 5136789 . Parent=533;ID=534;Name=Glyma17g07060 - Gm17 5135289 5136789 . ... (2 Replies)
Discussion started by: grace_shen
2 Replies

10. Shell Programming and Scripting

How to add line numbers (multiples of 5: 0,5,10,15,20) to a text file?

Hi, I need to number the lines in my text file. I know how to do this with standard numbering (1,2,3,4, etc) but I need to count in multiples of 5, beginning 0,5,10,15... example existing file: abcd efg hijklm nopqrs desired output 0 abcd 5 efg 10 hijklm 15 ... (11 Replies)
Discussion started by: livbaddeley
11 Replies
libart_lgpl_2.3(3)					 Introduction to Library Functions					libart_lgpl_2.3(3)

NAME
libart_lgpl_2 - Libart 2D drawing library DESCRIPTION
Libart is a vector-based 2D drawing library with antialiasing and alpha composition. A superset of the PostScript imaging model is imple- mented by the library. The library is written in optimized C code, has a very small memory footprint and has no dependencies on any other GNOME libraries. No API documentation is currently supplied with the library. FILES
The following files are used by this application: /usr/lib/libart_lgpl_2.sLibart 2D drawing shared library ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-libs | +-----------------------------+-----------------------------+ |Interface stability |External | +-----------------------------+-----------------------------+ SEE ALSO
libgnomecanvas(3) NOTES
Written by Mark McLoughlin, Sun Microsystems Inc., 2003. SunOS 5.10 10 Jan 2003 libart_lgpl_2.3(3)
All times are GMT -4. The time now is 07:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy