Lil'Hasher
March 28th, 2003, 03:55 PM
Hi all,
this is actually more of a Unix question .... (maybe).
Within my C++ code i'd like to sort a file based on a particular field. The file has *no field delimiters* but i know the byte length of each field. The only way i can think of doing this effeciently is using a system call to Unix's "sort". However from what i can tell sort doesn't work when sorting by a particular field, unless the file is field delimited or has at least one blank space between fields. My file has neither.
So my question is, is there effecient way to sort this file using either C++ code or System calls to unix commands?
(and again the sorting is on a particular field)
Also, why doesnt unix allow sorting based on a byte position (byte interval)???
thanks as always,
lil hasher
this is actually more of a Unix question .... (maybe).
Within my C++ code i'd like to sort a file based on a particular field. The file has *no field delimiters* but i know the byte length of each field. The only way i can think of doing this effeciently is using a system call to Unix's "sort". However from what i can tell sort doesn't work when sorting by a particular field, unless the file is field delimited or has at least one blank space between fields. My file has neither.
So my question is, is there effecient way to sort this file using either C++ code or System calls to unix commands?
(and again the sorting is on a particular field)
Also, why doesnt unix allow sorting based on a byte position (byte interval)???
thanks as always,
lil hasher