The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
joining command results, and substitution ncatdesigner Shell Programming and Scripting 6 04-17-2008 08:37 AM
Formatting Substitution Command Not Working in vi ERPKEN UNIX for Advanced & Expert Users 11 05-06-2007 06:36 PM
complex command substitution spopuri Shell Programming and Scripting 5 05-24-2006 05:37 AM
command substitution problems with csh using grep voodoo31 Shell Programming and Scripting 2 01-14-2006 04:39 AM
Substitution of last command ghazi Shell Programming and Scripting 6 01-16-2005 04:06 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 10-04-2005
Registered User
 

Join Date: Jul 2005
Location: Chennai
Posts: 39
Preserving space during command substitution

Hi all,

I am caught up in a problem .... tried all possible ways i knew .. but ended up in big zero ... ;-(

I have a file as below ..

$ cat siv.txt
1234567890BF00522000095ibsadministrator@ae.ge.com ibsadministrator@ae.ge.com

Note the spaces in between .... I am doing a cut on this ..

$ head -1 siv.txt | cut -c 11-
BF00522000095ibsadministrator@ae.ge.com ibsadministrator@

The spaces are preserved ... Well and good till here ...
But I need to assign this output to a variable and still preserve the spaces in the output which I am not able to do ..

$ bt=`head -1 siv.txt | cut -c 11-`
$ echo $bt
BF00522000095ibsadministrator@ae.ge.com ibsadministrator@

The spaces get truncated ...

Pls help me here...

Thanks in advance,

SNS
Reply With Quote
Forum Sponsor
  #2  
Old 10-04-2005
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,683
How about
Code:
echo "$bt"
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 10:04 AM.


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

Content Relevant URLs by vBSEO 3.2.0