Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: problems with backreference

by ikegami (Pope)
on Sep 06, 2011 at 15:33 UTC ( #924422=note: print w/ replies, xml ) Need Help??


in reply to problems with backreference

\1 is a regular expression pattern that matches what the first capture captured. It makes no sense to use it outside of regular expressions as you did.

Perl script:

s/^(ISA\~.*?\~.*?\~.*?\~.*?\~.*?\~.*?\~.*?\~)(..........)(....).(\~.*) +$/$1${2}0$3$4/

Perl command:

perl -i -pe's/^(ISA\~.*?\~.*?\~.*?\~.*?\~.*?\~.*?\~.*?\~)(..........)( +....).(\~.*)$/$1${2}0$3$4/' PB385930.P0

ssh command:

ssh ... 'perl -i -pe'\''s/^(ISA\~.*?\~.*?\~.*?\~.*?\~.*?\~.*?\~.*?\~)( +..........)(....).(\~.*)$/$1${2}0$3$4/'\'' PB385930.P0'

Note the ' needed to be escaped when placed inside another ' literal.


Comment on Re: problems with backreference
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://924422]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2014-09-19 03:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (129 votes), past polls