while read EachRecord
do
echo "EachRecord = "$EachRecord
$EachRecord | cut -f1
#cut -f2 ./input.txt
done < input.txt
fi
*
*************
hi guys how can i pass value to cut command from $EachRecord
while read EachRecord
do
echo "EachRecord = "$EachRecord
$EachRecord | cut -f1
#cut -f2 ./input.txt
done < input.txt
fi
*
*************
hi guys how can i pass value to cut command from $EachRecord
To keep the forums high quality for all users, please take the time to format your posts correctly.
First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags
```text
and
```
by hand.)
Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.
Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.
Thank You.
The UNIX and Linux Forums
simple...
echo $EachRecord | cut -f1 -d"your_delimiter"
echo $EachRecord | cut -d " " -f1
(you also need to specify a delimeter (using -d))
Hello
If you donot know answer no need to reply
Are you talking me me or to DukeNuke2?!
Not you sir
---------- Post updated at 07:21 PM ---------- Previous update was at 07:19 PM ----------
Thank you very much scottn its working
---------- Post updated at 07:42 PM ---------- Previous update was at 07:21 PM ----------
while read EachRecord
do
echo "EachRecord = "$EachRecord
s = echo $EachRecord | cut -d " " -f1
p = echo $EachRecord | cut -d " " -f2
echo $s
echo $p
$UXEXE/uxext tsk ses=$s vses=* upr=* model mu=$p `output=$p_$s.pnf` APP
done < input.txt
fi
}
Hi Guys
my requirement is like after taking the input from cut command i want to pass the value to command $UXEXE/uxext tsk ses=$s vses=* upr=* model mu=$p `output=$p_$s.pnf` APP
but when i do
echo $s
echo $p
i donot get the cut command value
Hi.
What DukeNuke was trying to tell is to use code tags...
You need to execute the echo statements to get the values you want:
s=$(echo $EachRecord | cut -d " " -f1)
p=$(echo $EachRecord | cut -d " " -f2)
Oh my god i took in some other manner
i am feeling very soory
---------- Post updated at 08:01 PM ---------- Previous update was at 07:48 PM ----------
Hello Scottn
Still i am in confusion functionality is like while statement should keep on running till the end of last line of my input file and cut should cut some specific data from each line of input file and it must and than than i want to passs value of s and p to command
$UXEXE/uxext tsk ses=$s vses=* upr=* model mu=$p `output=$p_$s.pnf` APP
i mean it should not end till i reach the last line of the input line and cut should cut each line one by one
s = echo $EachRecord | cut -d " " -f1
p = echo $EachRecord | cut -d " " -f2
it should be
s=`echo $EachRecord | cut -d " " -f1`
p=`echo $EachRecord | cut -d " " -f2`
note: no spaces around '=' and use of backticks
Not sure I follow you. Do you want to run this for each line in your input file?:
$UXEXE/uxext tsk ses=$s vses=* upr=* model mu=$p `output=$p_$s.pnf` APP
If so, then it's in the right place.
There is one tiny thing wrong:
$UXEXE/uxext tsk ses=$s vses=* upr=* model mu=$p `output=${p}_$s.pnf` APP
while read EachRecord
do
echo "EachRecord = "$EachRecord
s=`echo $EachRecord | cut -d " " -f1`
p=`echo $EachRecord | cut -d " " -f2`
echo $s
echo $p
$UXEXE/uxext tsk ses=$s vses=* upr=* model mu=$p `output=$p_$s.pnf` APP
done < input.txt
Hope this will help..
Hello
sorry was sick for the last weak
I have made changes in my code as below
while read EachRecord
do
echo "EachRecord = "$EachRecord
s=`echo $EachRecord | cut -d " " -f1`
p=`echo $EachRecord | cut -d " " -f2`
echo $s
echo $p
$UXEXE/uxext tsk ses=$s vses=* upr=* model mu=$p `output=$p_$s.pnf` APP
done < input.txtu_fdge50.001
*********
but when i am executing the script it is creating a file name u_fdge50.001 and in this some data related to my first inut is there.
It should not be like this
i must have output on console for each input like below:
G_BDRPARIS_BDRJX331.pnf
G_BDRPARIS_BDRJX501.pnf
and it seems it is not reading the 2 line of input file,it is again and again reading 1st line of input line
You forgot the code tags again 
Change this line:
$UXEXE/uxext tsk ses=$s vses=* upr=* model mu=$p `output=$p_$s.pnf` APP
To
$UXEXE/uxext tsk ses=$s vses=* upr=* model mu=$p output=${p}_$s.pnf APP
You have to separate the two variables p and s otherwise all you'll get is the value of s.
And I removed the ` backticks around output=
What were they for?
Hello
You are right it is working and giving the output of first input of first line of input file but now why it is not going to second line of input file ,it must go to 2nd line and than should give 2 output like that till end of my input file
It might be related to this program?
$UXEXE/uxext tsk ses=$s vses=* upr=* model mu=$p `output=$p_$s.pnf` APP
(I don't know what it does - what does it do?)
Try commenting the line out to see what happens.
Then, try this and see what it says:
exec 3< input.txtu_fdge50.001
while read EachRecord <&3
do
echo "EachRecord = "$EachRecord
s=`echo $EachRecord | cut -d " " -f1`
p=`echo $EachRecord | cut -d " " -f2`
echo $s
echo $p
$UXEXE/uxext tsk ses=$s vses=* upr=* model mu=$p output=${p}_$s.pnf APP
echo $?
done
o/p
EachRecord = BDRJX501 G_BDRPARIS
BDRJX501
G_BDRPARIS
Object ( , BDRJX501 , 001, G_BDRPARIS, BDRSYRXTR , 001) extracted
0
Hi Scottn,
i want to know how can i automate sftp command.
When i execute the script the sftp connect to host and ask for the password but i want password also to be supplied in batfile .It should not ask password on console .
sftp -b batfile user@hostip
Any suggestion from your side
Hi.
I believe Jim is right: sftp command
I think older versions of sftp may have allowed a password to be given in a batchfile, but newer versions don't.