⭐ in reply to What is the simplest way to print a field, as in $3 does in awk
Use the -a switch to autosplit to @F.
John.
or perl -lne 'print if /localhost/' /etc/hosts --perl -lane 'print if $F[1] =~ /localhost/' /etc/hosts
John.
In Section
Seekers of Perl Wisdom