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

trim(variable)

Status
Not open for further replies.

BobRaney

Programmer
Nov 22, 2001
59
US
Hello,

I will be writing some shell scripts that will be used on an RS-6000 system AIX 4.3.
Is there any function that will trim leading and trailing spaces as the TRIM() Function does in Visual Basic?

test=" abcd "
echo $test"with spaces"

this will display
abcd with spaces

Thanks

Raney

 
tr -d " "

This will delete all white space from your output... here's how you would run it:

test=" abcd "
echo $test | tr -d " "

Note: This will delete all white space.. not just from the start and end... Is this what you are looking for? If not, then you can do it a few other ways.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top