Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Replace strings with "("

by leriksen (Curate)
on Jan 30, 2005 at 03:12 UTC ( #426333=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Replace strings with "("
in thread Replace strings with "("

Are you reading these in from a file and seeing that their not changed in the file ?

If so, try this recipe for in-place editing

prompt> perl -i -pe 's/"t/"GC_t/' file_to_be_changed.txt

The -i flag tells perl to make changes (like regex substitutions) in the original file, dont make a backup

The -pe is two options joined together - -p is print every line in the supplied file back out to itself (thats what -i and -p together do - print every line back to the same file)

The -e tells perl to apply the regex to every line in the file - and hence the "t lines become "GC_t before being printed back out.

You can find more options like these in "perldoc perlrun", or Perl Command-Line Options.

Cheers

...it is better to be approximately right than precisely wrong. - Warren Buffet


Comment on Re^3: Replace strings with "("
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (15)
As of 2015-07-28 16:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (258 votes), past polls