On 12/14/06, Mrugesh Karnik mrugeshkarnik@gmail.com wrote:
On Thursday 14 December 2006 14:08, Philip Tellis wrote:
Sometime on Dec 13, PN cobbled together some glyphs to say:
I am writing a shell script where I retrive values from a text file
using
cut. I want to save these into variables.
The script is something like this...
grep searchtext file | cut -f 1,3,7,8
I want to save the values returned by cut into 4 different variables.
This works:
read a b c d <<EOF $( grep searchtext file | cut -f 1,3,7,8 ) EOF
Thanks!
read a b c d <<<$(grep Hubert /home/mrugesh/text/list | cut -f 1,3,5,7)
This method worked really well. Saved a lot of time.
I had to use awk though, cause, some variable were blank and read used would not assign blank value to a variable. It would assign the value of the variblble after that... and leave a blank at the end.
- pascal.
--
Mrugesh Karnik GPG Key 0xBA6F1DA8 Public key on http://wwwkeys.pgp.net