rediret output to variable...

Hi i have a problem in redirecting the ouput to a variable.I want to use that variable in the script itself.

here is my problem...

unique.out "UNIX" | grep Encrypted | awk '{FS=" "} {print $2}' .

unique.out is and executable file that generates uniqe id WITH THE FOLLOWING FORMAT.
Using Key .....
Trying to Encrypt UNIX ......
Uniqe Code: 123232312434, lenght 32"

AND also i not able to take out of that coma( ,)from the uniqeid. please help me to remove that comma from the output and put that output in a varaible.

please help me on this issue.
Thanks in advance...
.

Check man page or usage document of the command. It should have option to output the code only (in fact, it should be the default). If not, the person who wrote the program doesn't understand Unix.
In case of the latter situation, do

awk -F'[:, ]' '/Uniqe Code:/{print $4}'

if it doesn't work for your awk, then

awk '/Uniqe Code:/{sub(",", "", $2);print $2}'
1 Like