SYNOPSIS

PERL PROGRAM NAME:

AUTHOR: Juan Lorenzo (Perl module only)

DATE:

DESCRIPTION:

Version:

USE

NOTES

Examples

SYNOPSIS

SEISMIC UNIX NOTES SUSORT - sort on any segy header keywords

 susort <stdin >stdout [[+-]key1 [+-]key2 ...]			



 Susort supports any number of (secondary) keys with either	

 ascending (+, the default) or descending (-) directions for 	

 each.  The default sort key is cdp.				



 Note:	Only the following types of input/output are supported	

	Disk input --> any output				

	Pipe input --> Disk output				



 Caveat:  On some Linux systems Pipe input and or output often 

		fails						

	Disk input ---> Disk output is recommended		



 Note: If the the CWP_TMPDIR environment variable is set use	

	its value for the path; else use tmpfile()		



 Example:							

 To sort traces by cdp gather and within each gather		

 by offset with both sorts in ascending order:	

 

 key1 = cdp

 key2 = offset		



 	susort <INDATA >OUTDATA cdp offset			



 Caveat: In the case of Pipe input a temporary file is made	

	to hold the ENTIRE data set.  This temporary is		

	either an actual disk file (usually in /tmp) or in some	

	implementations, a memory buffer.  It is left to the	

	user to be SENSIBLE about how big a file to pipe into	

	susort relative to the user's computer.			





 Credits:

	SEP: Einar Kjartansson , Stew Levin

	CWP: Shuki Ronen,  Jack K. Cohen



 Caveats:

	Since the algorithm depends on sign reversal of the key value

	to obtain a descending sort, the most significant figure may

	be lost for unsigned data types.  The old SEP support for tape

	input was removed in version 1.16---version 1.15 is in the

	Portability directory for those who may want to input SU data

	stored on tape.



 Trace header fields modified: tracl, tracr

User's notes (Juan Lorenzo) untested

CHANGES and their DATES

Import packages

instantiation of packages

Encapsulated hash of private variables

sub Step

collects switches and assembles bash instructions by adding the program name

sub note

collects switches and assembles bash instructions by adding the program name

sub clear

sub header_word

sub headerword

legacy Nov 2 2018
   selects which headerword on which to sort in the order provided
 multiple calls to this subroutine
 will work

sub key1

sub key2

sub get_max_index

max index = number of input variables -1