baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:
well it has been a while since i posted anything, but .... :)
today i'm dissatisfied with search and replace engines that many editors provide , like notpade++, UE ... well the problem is that they work perfectly when replacing is done on small dataset, but when something like this is done on a dataset that is 1GB in size.... well i'll just say THANK YOU LARRY!.
but where is the problem then, the problem is that my colleges don't do programming and i'm tired of writing these short scripts to modify their documents, so my idea was to make a short template script that they could just modify a bit and run. But after only one week this script looked like a child was hitting the keyboard with a hammer and those random commands were so pose to be lines of Perl code or something . so that was obvious 'no go'
now i decided to do a small script that the user could use from a command line like
to search for expression ##(.*?)_kxx and replace it with a KO$1 , therefore leaving the expression matched under (.*?)../regex.pl Input.file '##(.*?)_kxx' 'KO$1'
but the problem is, i can't figure out how to pass $1 to the script for evaluation. i tried many ways but none seems to do the job. so please any hint would be more then appreciated :).
and let say i wish to do this:#!/usr/bin/perl use strict; while(<DATA>){ $_ =~ s/$ARGV[0]/$ARGV[1]/g; print $_; } __DATA__ |Chlre4|328957|pg._10_#_1 |Chlre4|28893|est.pg.C_80374 |Chlre5|338325|pm.pg._10_#_4
thnxregex.pl '\|(\d+)\|' "#$1#"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex parser needed
by moritz (Cardinal) on Apr 30, 2010 at 09:09 UTC | |
by bart (Canon) on May 01, 2010 at 07:46 UTC | |
|
Re: regex parser needed
by AnomalousMonk (Archbishop) on Apr 30, 2010 at 15:42 UTC |