Pipe variable to CUT

Venkatachalam, Saravanakumar saravanan at ti.com
Thu Apr 14 04:25:36 UTC 2005


Jeff Boyce wrote:

> Greetings -
>
> I am having a problem using CUT to obtain a subset of text within a 
> variable in a simple shell script.  The purpose of the shell script is 
> to obtain the current name of the tape in my tape drive so that I can 
> determine if it the appropriate tape to recycle.  The first line of 
> the script reads the name currently assigned to the tape.  The output 
> of VALUE2 below should produce the text *Wednesdays*, instead it is 
> producing nothing.  If I manually enter..... tpname=Wednesdays|cut -f2 
> --delimiter=..... I get the output.... Wednesdays.  But when running 
> the script below I get nothing. $VALUE1|cut -f2 -d= produces the same 
> result.  What am I missing, possibly some simple escape or quote?
>
> Input Script
> VALUE1=`arkc -drive -read -D name=BisonTape`
> echo 'Value1 : '$VALUE1
> VALUE2=$VALUE1|cut -f2 --delimiter=
> echo 'Value2 : '$VALUE2
>
> Display Output
> Value1 : tpname=Wednesdays
> Value2 :
>
>
> Jeff Boyce
> www.meridianenv.com
>
>
hi,
 you missed the echo command and back quotes

try this..

VALUE2=`echo $VALUE1|cut -f2 --delimiter=`

regards,
saravanan




More information about the redhat-list mailing list