Sorting a Dictionary File
I have this dictionary file that has this format:
SUBSTITUTE_VALUE, Real Value SUBSTITUTE_VALUE_2, Real Big Value SUBSTITUTE_VALUE_HECL, Hardware Abstract SUBSTITUTE_V, Valley Mem I want to sort this file so the LONGEST Substitute Values are listed at the top ( so SUBSTITUTE_VALUE_HECL would be first in the list). Obviously I want to keep the related values tagging along with them, so the whole first line would be SUBSTITUTE_VALUE_HECL, Hardware Abstract Playing with sort This has me pretty close: sort dict.file -k1.1n,1 |
So you want to sort by the length of the first field. I would use awk to generate the length.
(1) use awk to copy the output file thus: nLength, Field1, Field1 (2) Sort the output (3) Use awk again to delete the first field. OK |
Please post your thread once and in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread should be closed or merged because it is a duplicate of http://www.linuxquestions.org/questi...y-file-841773/.
|
All times are GMT -5. The time now is 05:02 PM. |