Reputation: 717
My File content:
Apple
Banana
orange
Donkey
Elephant
Fox
Good
I am trying to arrange elements that is there in a single column(as shown above) into two columns as shown below:
Expected output:
Apple Banana
Orange Donkey
Elephant Fox
Good
Is there any way in Sed or awk to achieve this?
Upvotes: 1
Views: 42
Reputation: 26667
How about something like
$ awk 'ORS=(NR%2)?" ":"\n"' input
Apple Banana
orange Donkey
Elephant Fox
Good
OR
$ awk 'ORS=(NR%2)?FS:RS' input | column -t
Apple Banana
orange Donkey
Elephant Fox
Good
Upvotes: 2