Re: Shell Scripting question
Re: Shell Scripting question
You can assign the result of your commands to a variable using back quotes. For instance, in order to have a formatted string you can have:
Code:
a_filename=`echo ${i} | awk '{printf("foo%03d.txt", $1)}'`
In the same way, you can have:
Code:
var1=`tqladmin -info | sed '1,2d'`
var2=`echo ${var1}|awk '{ if (($2 != "LOADER") && ($2 != "ALARMER") && ($2 != "DBA") && ($2 != "LAUNCHER")) print}'`
(not tested)
Re: Shell Scripting question
Quote:
Originally Posted by olivthill
You can assign the result of your commands to a variable using back quotes. For instance, in order to have a formatted string you can have:
Code:
a_filename=`echo ${i} | awk '{printf("foo%03d.txt", $1)}'`
In the same way, you can have:
Code:
var1=`tqladmin -info | sed '1,2d'`
var2=`echo ${var1}|awk '{ if (($2 != "LOADER") && ($2 != "ALARMER") && ($2 != "DBA") && ($2 != "LAUNCHER")) print}'`
(not tested)
Hi olivthill,
thank you for your answer,
I tried to copy the file in a variable like you indicate but the problem is that the tqladmin command returns a list of variables like below:
13630 PHAT NPRDB 13597
7565 NVAG NPRDB 19862 npru
8651 ASOF NPRDB 14920 npru
If I move this output to a variable, the list will be lost and I wont be able to process it with awk.
The variable will be like this: 13630 PHAT NPRDB 13597 7565 NVAG NPRDB 19862 npru 8651 ASOF NPRDB 14920 npru