Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Record length with sort

Status
Not open for further replies.

tony100

MIS
Dec 15, 2002
3
JP
I am sorting a number of files all of the same record length, 5051 bytes into 1 file. The files are keyed on bytes 1 to 31. The command I am using is

sort -T /dev/tmpusr -o /dev/tmpusr/fileout -k 1.1,1.31 file1 file2 file3 file4

the output file is then of varying record length which causes me problems in using the file as it needs to be fixed length 5051 bytes.

A warning error message is being produced during the sort execution:

sort: Warning: A newline character was added to the end of file file1

Do you know how I can force the record length to remain 5051 bytes ?
 
Are these line oriented files? In other words is each 5051 byte record seperated by a newline. sort is designed to work on text files.

You could also try adding -z 5055 to your sort command. This will make sure you aren't overflowing the line buffer.
 
Thanks for your reply, fyi got round the problem by using mfsort which allows a file record definition for each input and output file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top