Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Incredibly simple question i'm sure but I can't seem to figure it out. I'm attempting to perform an in-place search and replace on multiple .txt files within a directory - and want this to be confined to a specific column only. I've tried:
perl -pi -w -lane '$F[0] = s/AAA/BB/;' *.txtBut this replaces AAA with BB globally, rather than within $F[0] only. Why is this happening?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: In-place search and replace confined to a specific column
by Eily (Monsignor) on Jan 29, 2016 at 10:45 UTC | |
by Discipulus (Canon) on Jan 29, 2016 at 11:40 UTC | |
|
Re: In-place search and replace confined to a specific column
by Corion (Patriarch) on Jan 29, 2016 at 09:52 UTC | |
by Anonymous Monk on Jan 29, 2016 at 09:55 UTC | |
by Discipulus (Canon) on Jan 29, 2016 at 10:05 UTC |