set str with output from piped commands

February 22, 2010 at 08:12:55
Specs: Windows XP
That's all I'd like to ask :-)
How do I set a string (variable) using data from a command like e.g.
more citrix.log | grep "100%% loss" | wc -l

See More: set str with output from piped commands

Report •

#1
February 22, 2010 at 08:19:25
"unix" or "windows"?

Report •

#2
February 22, 2010 at 08:23:30
sorry it's windows xp

Report •

#3
February 22, 2010 at 08:37:09
not tested:
for /f "tokens=*" %%a in ('find /i /c "100% loss" citrix.log') do set losses=%%a
echo %losses%

Report •

Related Solutions

#4
February 23, 2010 at 02:48:44
That should work ... note that this would work in *nix:

mycounter=`grep "100%% loss" citrix.log | wc -l`

Don't know what emulation you are using, maybe the reverse single quote thing works, probably it doesnt, but you can try.


Report •

Ask Question