user446069
user446069

Reputation: 59

How to convert rows to columns and vice versa

cat > input
0,4880,1;1,8877,1;2,LT33A,0;3,2224,1;4,4926,1;

Output should be like below
0,4880,1
1,8877,1
2,LT33A,0
3,2224,1
4,4926,1

Can anybody help me out?

Upvotes: 0

Views: 6342

Answers (3)

ghostdog74
ghostdog74

Reputation: 342363

$ echo "0,4880,1;1,8877,1;2,LT33A,0;3,2224,1;4,4926,1;" |awk -vRS=";" 'NF'
0,4880,1
1,8877,1
2,LT33A,0
3,2224,1
4,4926,1

Upvotes: 0

codaddict
codaddict

Reputation: 454990

You can use sed as:

sed 's/;/\n/g' file

Upvotes: 1

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798606

tr ';' '\n' < input

Upvotes: 2

Related Questions