May 26, 2017, 7:18 AM
Post #2 of 4
Re: [sandysk] store grep value in variable so i can use that variable value
[In reply to]
this does not look like Perl code.
looks more or less as shell scripting under Unix or Linux.
grep \'/123CHAR' %s | wc -l
sprintf does not print to a file, it formats a string, and it's first argument is a format string, for example something like "%s %2.7f".
Assuming cmd is supposed to contain a command issued to the system, it would need to be stored in a variable, for example $cmd, properly declared.
And system() returns the status return by the system command, not the output of that command. For getting the output use backticks `$cmd` or qx/.../.
It would be better if you explained, and illustrated with examples, what your input is supposed to and what you expect as output.