Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig >> mail # user >> Including a simple regex with -param


Copy link to this message
-
Re: Including a simple regex with -param
Use single quotes around the param value so that shell does not interpret the "|" . (in case of bash shell)

$ cat t.pig
matches '.*\\b($keyword)\\b.*';

$ java -Xmx500m -cp pig.jar org.apache.pig.Main -dryrun -x local        -param keyword='abc|def' t.pig
2011-01-14 13:23:56,670 [main] INFO  org.apache.pig.Main - Logging error messages to: /Users/tejas/pig_comb2/trunk/pig_1295040236668.log
2011-01-14 13:23:56,699 [main] INFO  org.apache.pig.Main - Dry run completed. Substituted pig script is at t.pig.substituted

$ cat t.pig.substituted
matches '.*\\b(abc|def)\\b.*';

On 1/14/11 9:28 AM, "Shane Eller" <[EMAIL PROTECTED]> wrote:

I'm having trouble finding a way to include a simple regex string with the -param flag.

Example: pig -f myscript.pig -param keyword=buy|price|sell|sale|discounts

I've tried a mix of quotes, escapes, etc and nothing seems to work. The corresponding line in my pig script looks something like

matches '.*\\b($keyword)\\b.*';

Any help or comments would be appreciated.

--
Shane
[EMAIL PROTECTED]
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB