Answers for "bash how to transpose a column"

1

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
Posted by: Guest on September-16-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language