1
Q:

bash how to transpose a column

# Basic syntax:
operation producing a column of text/data | paste -s 
# Where paste -s prints the data on a single row

# Example usage:
Given a file named input_file that has these contents:
A	23
B	42
C	17

cut -f 2 | paste -s
awk '{print $2}' | paste -s 
would both print:
--> 23	42	17

# Note, use the -d flag to change the delimiter of the paste output
1

New to Communities?

Join the community