Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SED TO JOIN WORDS

Status
Not open for further replies.

beaster

Technical User
Aug 20, 2001
225
US
I have a file called file1.txt

The contents are similiar to:

big red dog jumps over fence
blue bird in yard
hound chases fox

I need to use sed or something else to read the input file and output to new file2.txt after joining all the words to look like:

bigreddogjumpsoverfence
bluebirdinyard
houndchasesfox

Any help would be appreciated!
Beaster
 
A starting point:
sed 's! *!!' /path/to/input > output

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
sed 's/ //g' file1.txt > file2.txt

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
tr -d '[:blank:]' <inputfile >outputfile

or

tr -d ' \t' <inputfile >outputfile

should work as well.

HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top