Skip to content
Advertisement

sort lines of a file alphanumerically

I have a text file in linux. I want to sort each line w.r.t. other line alphanumerically. Linux sort command ‘sort ‘ does not sort alphanumerically. File is not column based. Specifically I want below two files to match in diff comparison but I am unable to do so. Can you help? First file content is

        2. Scope: /tb/srflop_inst, File: ./aaa/bbb/abc.xyz(155)
            Model: Default AG output
                1. /tb/srflop_inst/srff_q1
                2. /tb/srflop_inst/srff_q2

Second file content is

        2. Scope: /tb/srflop_inst, File: ./aaa/bbb/abc.xyz(155)
            Model: Default AG output
                1. /tb/srflop_inst/srff_q2
                2. /tb/srflop_inst/srff_q1

Advertisement

Answer

It’s better to do sort in the program that is generating this output.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement