TRASPOSE FILE CONTENTS IN UNIX

PROBLEM STATEMENT:

Given a text file file.txt, transpose its content.

You may assume that each row has the same number of columns and each field is separated by the ‘ ‘ character.

Example:

If file.txt has the following content:

name age
alice 21
ryan 30

Output the following:

name alice ryan
age 21 30

SOLUTION:

Click here for the answer.

Similar questions and answers:

Calculate the frequency of each word in a text file

Print all valid phone numbers from a file

 

 

Comments

comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: