in reply to On Match Remove Field
Perl already has the -pi options to edit files line by line, either editing in place or saving a backup file if you use -p -i.bak. Add -a to split each line, same as awk does. if you want to split on a different character other than a space, you can specify it with -F, but you want space splits
perl -pia -e"splice @F, 1, 1 if $F[1] =~ /[A-Z]\./i or $F[1] eq 'jr.' + "
As Occam said: Entia non sunt multiplicanda praeter necessitatem.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |