[tpm] How to pipe variable content to shell scripts

Fulko Hew fulko.hew at gmail.com
Tue Jan 21 10:19:25 PST 2014


On Tue, Jan 21, 2014 at 12:29 PM, Antonio Sun <tpm.ats at spamgourmet.com> wrote:
>
> Hi,
>
> I have a script that works on xml content. A thousand time simplified version is:
>
>  xml_output | perl -n000e 's,(?<=">)(.*?)(?=</HttpBody>),`echo $1 | wc -c`,eg; print'
>
> I.e., I need to pipe the matching string ($1, content between tag HttpBody) to an external program via shell. As you can tell, if the matching content is too big for shell parameter length, my script will fail.
>
> I *have to* process the matching string via the external program. Is there any way I can get around this?

Why not just print the extracted $1 to stdout ... that gets piped into wc ?


More information about the toronto-pm mailing list