|
Delimited fields and formating
Hi
I am new to scripting. I have a file with following data
245|3|20090303456|3456
5072|34|20090304453|3546
245|28|20090304453|3547
5074|43|20090304453|3548
I want to format the file as below
245| 3|20090303456|3456
5072|34|20090304453|3546
245|28|20090304453|3547
5074|43|20090304453|3548
The main reason I want to do this is becase I want to sort the file using sort -n based on 1st 2 fields
If I do not reformat as above then sort -n will give
245|28|20090304453|3547
245|3|20090303456|3456
5072|34|20090304453|3546
5074|43|20090304453|3548
What I actually want is
245|3|20090303456|3456
245|28|20090304453|3547
5072|34|20090304453|3546
5074|43|20090304453|3548
Please help me.
Thanks and Regards
Adarsh
|