Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Apr 292009

Convert spaces into new lines using sed


If you have a text file like:

1 2 3 4 5

How to convert the spaces into new lines?

Use sed!

# sed 's/ /\n/g' text.txt

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>