Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

input.txt (around 30K lines)

RT|367079254|bn|ERTS01065811.1| 38 1 503
RT|367079251|bn|ERTS01065814.1| 56 3 502
RT|367079248|bn|ERTS01065817.1| 52 2 502

output.txt

RT|367079254|bn|ERTS01065811.1|
38
1
503
RT|367079251|bn|ERTS01065814.1|
56
3
502
RT|367079248|bn|ERTS01065817.1|
52
2
502
share|improve this question

3 Answers 3

up vote 1 down vote accepted

Sed:

sed -e 'y/ /\n/' infile

Awk:

awk 'BEGIN { OFS = "\n" } { $1=$1; print }' infile
share|improve this answer

I think your easiest way to do this is with tr:

tr '\t' '\n' < input.txt > output.txt

That'll turn all the tabs to newlines.

share|improve this answer
    
Easiest and fastest, too. –  JRFerguson Oct 2 '12 at 22:58
    
You should have been awarded this answer, as tr was the best solution. Both sed, and awk, while great tools, are overkill. –  TechZilla Nov 1 '12 at 14:50

With printf :

printf '%s\n' $(<FILE)
share|improve this answer
    
I wonder why this was down-voted. –  sputnick Oct 2 '12 at 22:41
    
Possibly because this will split on spaces not just tabs. –  jordanm Oct 3 '12 at 3:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.