[HPADM] Re: Outputting blanks in a variable - Solution

From: Buddy Mills (ramill@wm.edu)
Date: Tue May 24 2005 - 16:27:46 EDT


RE: [HPADM] Outputting blanks in a variableThanks to the following people that responded to my question.

Richard Wright
Roy Kidder
Andy Cranston
Shyam Hazari

Here was the "duh" simple solution

echo $test"$name"$test2

There was a solution using typeset that I found interesting and will try when I have more time.

Thanks all.

Buddy Mills
The College of William and Mary
757-221-2099 ramill@wm.edu
     I am trying to send a string of variable to a file used later in second program. The second program is expecting to see each variable in a certain position(s) The problem arises when I have a variable that is a random length.
   
  Example
  test=`cat /kfile|cut -c5-11`
  name=`cat /kfile|cut -c12-42`
  test2=`cat /kfile|cut -c1-4`
    
  kfile
  testtest012lastname,firstm (name,firstm varies)
    
  echo $test$name$test2 > newfile
    
  When $name varies in size, even thought I cut the same position including blanks, the blanks are not represented in the outputfile (newfile) which then put "test2" in the wrong position.

   
  I have done this before, but have since misplace the solution.
    
  Thanks in advance,
    
  Buddy Mills
  The College of William and Mary
  757-221-2099 ramill@wm.edu

--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:47 EDT