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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

spaces between words

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello,

Sentences like:

John is eating a lot of apples.
I need some help with this Awk script .
Al , the bear .

Should be turned into:

John is eating a lot of apples.
I need some help with this Awk script.
Al, the bear.

Does someone know how to deal with this? Thanks in advance!

Lizebé

 
or in sed:

------------------ spaces.sed --------------
s/[ ][ ]*/ /g
s/[ ][ ]*\([[:punct:]]\)/\1/g
------------------ spaces.sed END ----------

sed -f spaces.sed mySpacedFile.txt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top