I need to sort a file by the first column, if there is a numerical entry, and by the second column when there is none in the first. It looks basically like this:
3 - foo bar 1 1 foo bar - 5 foo bar 2 2 foo bar - 4 foo bar
and I need the output then to be
1 1 foo bar 2 2 foo bar 3 - foo bar - 4 foo bar - 5 foo bar
Is there any nice way to do that in linux with a single command? Thanks!