in reply to In-place search and replace confined to a specific column
As Discipulus pointed out, using both -p and -n doesn't make much sense. And you'll have to use the correct operator as Corion told you
Your issue is that -p prints $_ no matter what, it doesn't print back the splitted data of @F. You have to do that yourself: $" = qq(\t);$_="@F"; You'll find $" in perlvar.
Edit: you can try this to see the code that perl generates from your one liner: perl -MO=Deparse -pae '$_ = @F'
LINE: while (defined($_ = <ARGV>)) { our(@F) = split(' ', $_, 0); $_ = @F; } continue { die "-p destination: $!\n" unless print $_; }
Edit: replaced $"="\t"; by $" = qq(\t); because the first one looked like a syntax error.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: In-place search and replace confined to a specific column
by Discipulus (Canon) on Jan 29, 2016 at 11:40 UTC |