With the following input file:
rohit
mohit
sohit
34
45
67
开发者_运维百科I have to create a new file with following:
rohit 34
mohit 45
sohit 67
by only using paste & sed. Any ideas on how this could be done?
$ paste -d' ' <(sed '3q' input.txt) <(sed -n '4,$p' input.txt)
rohit 34
mohit 45
sohit 67
$ cat input.txt
rohit
mohit
sohit
34
45
67
$ sed -e '/^[^0-9].\+/ d' < input.txt | paste input.txt - | sed -e '/^[0-9]\+/ d'
rohit 34
mohit 45
sohit 67
精彩评论