HP3000-L Archives

November 2013, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Roy Brown <[log in to unmask]>
Reply To:
Roy Brown <[log in to unmask]>
Date:
Thu, 7 Nov 2013 23:50:54 +0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (51 lines)
In message <[log in to unmask]>, Olav Kappert 
<[log in to unmask]> writing at 16:32:19 in his/her local time 
opines:-
>I would like to know the background for how the Unix sort works with keys.
>
>The cmd is   ---  sort -t \& -o outfile -k 1.1,1.12 filea fileb  ---
>
>where filea and fileb are the input files and they are both 80 bytes in 
>length or in the unix world as byte stream.
>
>Since there is no "&" character in the file, it will treat the whole 
>record as one field.
>
>When looking at the data, it seems that the key was actually extended 
>for the length of the record or data while it should only be looking at 
>the 12 bytes in the key.
>
>This behavour is counter to the chronical order of the information 
>placed in the file.
>
>Does anyone have a solution as to how to sort/merge the files and 
>retain the chronical order otherwise ?
>
>~~~~~
>Just to make it interesting I also get the following message:
>
>   sort: Warning: A newline character was added to the end of the input.
>
>for each record sorted/merged.
>
>Why and how do you get rid of this message other than redirecting it to 
>$null.
>
>Olav.

Forgot to quote the man page reference.:-

http://unixhelp.ed.ac.uk/CGI/man-cgi?sort

Note also the -z option that may address your newline issue
and the comment about locale LC_ALL=C may also be germane.

Roy

-- 
Roy Brown        'Have nothing in your houses that you do not know to be
Kelmscott Ltd     useful, or believe to be beautiful'  William Morris

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2