If you have a file like this
Mike
Student:1:4
Boy
Student:3:4
Girl
:master
Then Output is:
Mike Student:1:4
Boy Student:3:4
Girl :master
If you have a file like this
Mike
Student:1:4
Boy
Student:3:4
Girl
:master
Then Output is:
Mike Student:1:4
Boy Student:3:4
Girl :master
Have a look at the paste command.
i.e.
paste - - < file
By default the delimiter is a tab, but you can change that.
thanks a lot... by the way im having problem with sort..
like
student20 hey
student1 name
student2 fire
student11 post
student3 back
output:
student1 name
student2 fire
student3 back
student11 post
student20 hey
I refer you to this recent thread: recent thread goes here!
$ sort -nk1.8 < file
student1 name
student2 fire
student3 back
student11 post
student20 hey
But, of course, that only works on the exact input you've given. It's always better when doing this kind of thing to pad numbers. Because there will always come a time when you want to use them for something!
no i did not create the correct output
the output was:
student1 name
student11 post
student20 hey
student3 back
By no i did not I presume you meant no it did not...
Please post exactly your input file, and the command you ran.
And, importantly, which OS you are using.
Thanks.
#cat filename | sort -nk1.8
student1 name
student11 post
student20 hey
student3 back
#