Sponsored Content
Full Discussion: Sorted file
Top Forums UNIX for Advanced & Expert Users Sorted file Post 302372216 by Tytalus on Tuesday 17th of November 2009 10:37:37 AM
Old 11-17-2009
Debian

man sort ;-)

e.g.

Code:
#  cat infile
a
b
d
c
f
e
#  sort -c infile
sort: disorder: c

#  cat  infile
a
b
d
e

#  sort -c infile

i.e. if not sorted will tell you.  if sorted will exit with no errors.

HTH
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sorted processes

Hi, I am trying to make a script that creates a list of all active (alive) processes sorted by size and then print this list on screen. Could anyone help me? Thaks a lot (7 Replies)
Discussion started by: pro
7 Replies

2. Shell Programming and Scripting

Removing duplicates in a sorted file by field.

I have data like this: It's sorted by the 2nd field (TID). envoy,90000000000000634600010001,04/11/2008,23:19:27,RB00266,0015,DETAIL,ERROR, envoy,90000000000000634600010001,04/12/2008,04:23:45,RB00266,0015,DETAIL,ERROR,... (1 Reply)
Discussion started by: kinksville
1 Replies

3. Shell Programming and Scripting

How to get a very big file sorted by contents of another variable list in one pass?

I have two list.... One has 17m (yes that's million) records in it which relate to the path and file name of individual text files. At the start of the pathname is a two character identifier identifying which category it belongs in as identified by a second file with the two character lookup... (10 Replies)
Discussion started by: Bashingaway
10 Replies

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

5. Shell Programming and Scripting

Collapsing and counting by key column in a sorted file

Hi I have a tab separated file with reads mappings of more than 2 million reads> the file is sorted by ID and looks like the following: SeqID Seq FreqSeq PosSeq HWI-EA332_0036:5:100:10131:16361#ATGC/1 GACTTGAGGTCTCCCCCGCA 1 TZRTMR_40497:317:+... (4 Replies)
Discussion started by: ramouz87
4 Replies

6. UNIX for Dummies Questions & Answers

Insert a line in a sorted text file(s)

Hello, I am trying to add a line (usually just a word) to some text files in a directory that are already sorted. I just don't want to run the sort command again because it can take a long time when the text or log files are really huge. I have a bashscript that will take in the 1st argument... (7 Replies)
Discussion started by: raptor25
7 Replies

7. Shell Programming and Scripting

Inserting lines from one file to a sorted list

Hello friends! I am working a Psychology/Neuro* project where I am sorting inline citations by category. The final step of the process has me a little stuck. I need to take citations from a text list and sort them in another text file. Here is a file X example... (1 Reply)
Discussion started by: danbroz
1 Replies

8. Shell Programming and Scripting

How to save sorted content of a inside the same file?

Hi All, When i use sort Test, here is the output: $ sort Test a b b c d e f g h i But the contents in the file remain unsorted, how to do that? ]$ cat Test g i (6 Replies)
Discussion started by: chandrakanth
6 Replies

9. UNIX for Beginners Questions & Answers

How to get script to create a new file that lists folder content sorted by size?

I have a script that sorts and processes unsorted files to newly created directories. Its working great, but I am trying to understand the leanest method to get the script to create an additional file within each newly created directory that: Contains a list of all files in the directory... (4 Replies)
Discussion started by: Braveheart
4 Replies

10. UNIX for Beginners Questions & Answers

How to create a summary file of all files in a directory sorted in reverse alphabetical order.?

I have an interactive script which works terrific at processing a folder of unsorted files into new directories. I am wondering how I could modify my script so that( upon execution) it provides an additional labelled summary file on my desktop that lists all of the files in each directory that... (4 Replies)
Discussion started by: Braveheart
4 Replies
evmsort(1)						      General Commands Manual							evmsort(1)

NAME
evmsort - sort events SYNOPSIS
show_template]] sport_spec] [filename | DESCRIPTION
The command reads and sorts a stream of EVM events. By default, events are read from and are sorted into ascending timestamp order. Sorted events are written to the command's stream in the form of raw EVM events. The sort order can be specified by supplying a sort_spec, either through the option or by setting the environment variable to the required specification. The specification is a character string of the form: key_item[ The key_item is the name of any EVM standard data item and the character is optional. If the special key_item is specified, the event's data item is expanded as described in the evmshow(1) manpage, and the resulting string is used as the sort key. The optional trailing or character indicates ascending or descending sort. By default, items are sorted in ascending order. Multiple items in the string are separated by colon characters The left-most key_item in the specification is the most significant key. If a key_item that is included in the sort specification is not present in an event read from the input stream, the item is considered to have a low value for that event. For example, if input events are being sorted in ascending order according to their data items, and one event does not contain a name, that event appears first in the output stream. If the option is specified, automatically starts and pipes the sorted event stream into it, producing a sorted and formatted display of events. If a argument is also specified with the specified template string is passed to through its own option. See the evmshow(1) manpage for more information. Options Automatically starts to produce a formatted display of the sorted events. The specification to be used in sorting events. See the section for the syntax of the sort_spec, and for details of the default sort order. Template string to be passed to if the option is also specified. If the option is not specified, this argument is ignored. See the evmshow(1) manpage for a description of the template string. Operands filename Reads event sources from filename. If filename is omitted, or is specified as event sources are read from EXTERNAL INFLUENCES
Environment Variables The following environment variables affect the execution of This variable contains a string formatted as described for a sort_spec. If the option is omitted, the string is used as the sort_spec. RETURN VALUES
The following exit values are returned: Successful completion. An error occurred. EXAMPLES
o The following example retrieves all events with a priority of 300 or greater, sorts them into descending order of priority (most urgent event first) and then ascending order of time (oldest event first), and automatically runs to display them. o The following example yields a list of all events, sorted with the latest event first within o The following example yields a list of all events, sorted first in order of their formatted messages and then sorted in ascending order of time. Events are passed to for display and subsequently to the command for viewing. WARNINGS
The command rejects attempts to output raw events to a terminal device. SEE ALSO
Commands evmget(1), evmpost(1), evmshow(1), evmwatch(1). Files evmchannel.conf(4). Event Management EVM(5). EVM Events EvmEvent(5). Event Filter EvmFilter(5). evmsort(1)
All times are GMT -4. The time now is 04:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy