Linux file sort with incomplete columns -


i need sort file first column, if there numerical entry, , second column when there none in first. looks this:

3 - foo bar 1 1 foo bar - 5 foo bar 2 2 foo bar - 4 foo bar 

and need output be

1 1 foo bar 2 2 foo bar 3 - foo bar - 4 foo bar - 5 foo bar 

is there nice way in linux single command? thanks!

on output follows format can use basic sort command:

sort -k 1,2 foo.txt 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -