I need to sort the lines of a text file (without any extension) where the lines are separated by %
. When using sort
command, those %
s are also getting sorted out which I do not want.
How to sort the text file from command line or by any other method and save with same name?
For example:
filename: myfile
Before sorting>>
A line one
%
C line two
%
B line three
%
After sorting>>
%
%
%
A line one
B line three
C line two
Desired>>
A line one
%
B line three
%
C line two
%