Concatenate echoed text with the results of a grep command?

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
I am attempting to move our group to TC9 from Cygwin UNIX on XP for our fairly hefty reporting requirements.

We found a set of UNIX commands fully ported to Windows that work well for our purposes, HOWEVER...

Frequently in our reporting we must concatenate echoed text with the results of an embedded grep command as shown below

UNIX command:
echo This file reports $(grep -c '<MerchantRecord action="Add">' CIS.xml) OPEN MerchantRecord tags >> CIS_Validate.txt

Resulting in:
This file reports 21622 OPEN MerchantRecord tags

Questions:
How do I achieve the same result when using the Windows-ported grep in TC9? What would that single line of code look like? Or, more precisely, how do we concatenate echoed text with the results of an embedded grep command as shown above from a batch file in TC9?
 
#2
How do I concatenate echoed text with the results of an embedded grep command?

> UNIX command:
> *echo This file reports $(grep -c '<MerchantRecord action="Add">' CIS.xml) OPEN MerchantRecord tags >> CIS_Validate.txt*
>
> Resulting in:
> This file reports 21622 OPEN MerchantRecord tags
D:\>echo This file reports %@execstr[myprog] OPEN MerchantRecord tags
This file reports 21622 OPEN MerchantRecord tags



--
Jim Cook
2008 Fridays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Saturday.
 
#3
How do I concatenate echoed text with the results of an embedded grep command?

JP Software Forums" <[email protected]>; "therealmikenelson wrote:
| I am attempting to move our group to TC9 from Cygwin UNIX on XP for
| our fairly hefty reporting requirements.
|
| We found a set of UNIX commands fully ported to Windows that work
| well for our purposes, HOWEVER...
|
| Frequently in our reporting we must concatenate echoed text with the
| results of an embedded grep command as shown below
|
| UNIX command:
| *echo This file reports $(grep -c '<MerchantRecord action="Add">'
| CIS.xml) OPEN MerchantRecord tags >> CIS_Validate.txt*
|
| Resulting in:
| This file reports 21622 OPEN MerchantRecord tags
|
| Questions:
| How do I achieve the same result when using the Windows-ported grep
| in TC9? What would that single line of code look like? Or, more
| precisely, how do we concatenate echoed text with the results of an
| embedded grep command as shown above from a batch file in TC9?

I would try

*echo This file reports %@execstr[(grep -c '<MerchantRecord action="Add">'
CIS.xml)] OPEN MerchantRecord tags >> CIS_Validate.txt*

(all on one line, of course).
--
HTH, Steve