The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 10-04-2005
Sabari Nath S Sabari Nath S is offline
Registered User
  
 

Join Date: Jul 2005
Location: Chennai
Posts: 46
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