passing the output of cmd from "eval" to a variable
Hello,
I need help with the eval command.
I have been building a lengthy cmd using eval, and I need to create $var from the output of the cmd. Here is what I have.
I have tried ...
With and without double quotes "" and __
I am running several eval grep-ing for various info and what I want to do is format the outputs and comma separate or use pipes and import it into excel.
so sometime like this after I get the eval --> $VAR
cat $VAR1 || $VAR2 || $VAR3 || >> results.txt .... then pull it into a .xls
If I understand correctly you don't need eval/variable and you don't need cat at all. Search your shell man pages for command substitution. You just need to format and spool the output (using printf, for example).
Thanks, but these commands I am buiding seem to require eval, due to whittespace and | symbols ect. the cat was only an example to show what I wanted to do with the formating, what I really need to know is how do take the output from my eval(command) and make it a variable like ---
but I can't get the syntex correct and I can't find a good example, I know it can be done and once I have that, the rest is cake!
once I get this, i will create a readable , maintainable spreadsheet, with all of my server info
example: hostname || IP || firmware || OS ver. || Memory || etc.
Oh, right. But that's the result of redirecting the output. If you want the result of the command to be both written to a file and printed to the standard output, use 'tee' command.
Hi All,
I am new here but I have a scripting question that I can't seem to figure out with the "find" cmd.
What I am trying to do is to only have to run a single find cmd parsing the directories and output the different file types to induvidual files and I have been running into problems.... (3 Replies)
Hello,
There's a third-party application's command that shows the application's status like "tail -f verybusy.log". When use the command, the output comes every 1-sec. but when it goes in a script below the output comes every 8-sec...What is the problem and how can I fix it?
open(CMD,... (2 Replies)
Hi all,
I am new to Linux/shell scripting having moderate knowledge.
In my script, I need to get execution time of a command (say 'ls') in mili seconds level. For this i tried using "time" command to retrieve the total execution time in milli seconds. But, the problem is that, how to save... (9 Replies)
Hi All,
I have working (Perl) code to combine 2 input files into a single output file using the join function that works to a point, but has the following limitations:
1. I am restrained to 2 input files only.
2. Only the "matched" fields are written out to the "matched" output file and... (1 Reply)
I intend to find the path/full location of a file(filename given by user thru "read filenme") using "find" or any other command and then store it's output in a variable for some other processing.
But struggling to put all things together (i.e finding the fully qualified location of that file and... (4 Replies)
Hi All,
I need to store the real seconds of the following command in a variable. How could it be done?
time $(dd if=/dev/zero of=/dev/sda1 bs=512 count=2048;sync)
Thanks,
Amio (12 Replies)
Hi All,
I am running my application on a dual cpu debian linux 3.0 (2.4.19 kernel).
For my application:
<sar -U ALL>
CPU %user %nice %system %idle
...
10:58:04 0 153.10 0.00 38.76 0.00
10:58:04 1 3.88 0.00 4.26 ... (0 Replies)
Hi guy,
I have a problem to pass a variable containing '*' value to FIND command.
below is the script. It doesn't work by submit below command:
rmf.sh name '*.txt'
or
rmf.sh name *.txt
I've tried either optn="-name '$2'" or optn="-name $2"., and there is no luck.
### (script... (5 Replies)