The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
To Trim spaces at the end of line sbasetty Shell Programming and Scripting 1 01-31-2007 06:01 PM
Trim trailing spaces from each line in a file tipsy Shell Programming and Scripting 5 09-13-2006 02:48 AM
Trim white spaces using awk mona Shell Programming and Scripting 2 07-28-2006 01:47 AM
Reversing and trim a String through SHELL script DeepakXavier Shell Programming and Scripting 5 09-28-2005 06:25 AM
Strip leading and trailing spaces only in a shell variable with embedded spaces jerardfjay Shell Programming and Scripting 6 03-07-2005 10:24 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-30-2007
Registered User
 

Join Date: Aug 2007
Posts: 26
Lightbulb TRIM spaces in shell

am get a value like ' 15' in a variable

what is the easiest method i can follow to strip 15 out
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 08-30-2007
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,643
Scroll to the bottom of this page to the Similar Threads section. The posts there should help you.
Reply With Quote
  #3 (permalink)  
Old 08-30-2007
Registered User
 

Join Date: Aug 2007
Posts: 26
i did a trial nd errror

echo |$CHECK|

CHECK=`printf "%d"$CHECK`
echo $CHECK


the result was
| 15|
15

it worked
Reply With Quote
  #4 (permalink)  
Old 08-31-2007
Registered User
 

Join Date: Feb 2007
Location: Pune, Dehradun (INDIA), Michigan(US)
Posts: 187
You can use "tr" command with -s option to truncate the space with the string !!
use: man tr for your reference !!

Thanks !!
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:16 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0