bash - Merge two columns of a text file in Linux -
i have text file several columns of text , values. structure:
car 38 dog 42 cat 89 car 23 ape 18
if column 1 has string, column 2 doesn't (or it's emptry string). , other way around: if column 1 empty, column 2 has string. in other words, "object" (car, cat, dog etc.) occurs in either column 1 or column 2, never both.
i'm looking efficient way consolidate column 1 , 2 file looks instead:
car 38 dog 42 cat 89 car 23 ape 18
i can in bash script using while , if, i'm sure there simpler way of doing it. can help?
cheers! z
try this:
column -t file
output:
car 38 dog 42 cat 89 car 23 ape 18