The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 06-05-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Wink tr command

tr -s " "
will suppress extra " " space charcters

Code:
> line2="This  2spaces   3spaces    4and5after     *"
> echo "$line2"
This  2spaces   3spaces    4and5after     *
> echo "$line2" | tr -s " "
This 2spaces 3spaces 4and5after *