• Uncategorized

About linux : When-sorting-why-is-1tab-greater-than-12tab

Question Detail

Here is the content of file.txt

A5RS12 <tab> R
A5RS1  <tab> R

That is, the string A5RS12 then a tab then the character R. On the next line, the string A5RS1 then a tab then the character R.

I ran the sort command:

sort -t '<ctrl-v> <tab>' -k 1 file.txt > out.txt

Here is out.txt:

A5RS12 <tab> R
A5RS1  <tab> R

No change to the order of the lines!

Later, I used the join command to join out.txt with another file. The join command generated an error message saying that out.txt is not sorted.

How do I sort file.txt so that it produces this ordering:

A5RS1   <tab> R
A5RS12  <tab> R

I am using Fedora 36.

Question Answer

No answer for now.

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.