Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 02-13-2009, 12:39 PM   #1
Registered: Jul 2005
Distribution: Gentoo, Ubuntu
Posts: 318

Rep: Reputation: 30
How to put every word in a new line in a file

I have a file with a bunch of words in it, separated by a single space. How do I make each word go on a separate line for each one and remove the spaces?
Old 02-13-2009, 12:53 PM   #2
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
sed -i s/\\s/\\n/g filename.txt
--- rod.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
BASH: Grepping/sedding/etc out part of a file... (from one word to 'blank' line) elinenbe Programming 2 12-11-2008 01:17 PM
sed to delete a line for a word and line above cmontr Programming 11 07-03-2008 08:33 AM
[SOLVED] find a word in a file, and change a word beneath it ?? vikas027 Programming 10 02-14-2008 09:46 PM
putting word in front of each line in a file stryka Slackware 3 12-06-2005 02:32 PM
add word to each line of the file? ziggie216 Linux - General 4 04-25-2005 04:19 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:37 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration