1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Concatenate echoed text with the results of a grep command?

Discussion in 'Support' started by therealmikenelson, Nov 21, 2008.

  1. therealmikenelson

    Joined:
    May 28, 2008
    Messages:
    5
    Likes Received:
    0
    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. Jim Cook

    Joined:
    May 20, 2008
    Messages:
    605
    Likes Received:
    0
    How do I concatenate echoed text with the results of an embedded grep command?

    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. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    How do I concatenate echoed text with the results of an embedded grep command?

    JP Software Forums" <neil@jpsoft.com>; "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
     

Share This Page