Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: In-place search and replace confined to a specific column

by Corion (Patriarch)
on Jan 29, 2016 at 09:52 UTC ( [id://1153980]=note: print w/replies, xml ) Need Help??


in reply to In-place search and replace confined to a specific column

You're using the wrong operator. You are assigning to $F[0] instead of using regex binding.

perl -pi -w -lane '$F[0] =~ s/AAA/BB/;' *.txt

could work.

Replies are listed 'Best First'.
Re^2: In-place search and replace confined to a specific column
by Anonymous Monk on Jan 29, 2016 at 09:55 UTC
    I did try this originally, but unlike '=', '=~' fails to replace anything at all unless -w and -pi are removed - but that then prevents me from batch processing all .txt files.
      hello, are not -p and -n togheter, a nonsense?

      L*

      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-19 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found