more on 1 liner perl/awk
Hi, It was fun reading s thead :-)
On Mon, Mar 10, 2003 at 04:02:47AM +0900, Youichi Mano wrote:
> I want to extract the lines of which the specified column is matched
> by command line programs(grep,cut,wc,...) not any script file.
So here is similar one liners but ...
awk '{ print $3 }' # extract third field separated by space
awk -F'\t' '{ print $3 }' # extract third field separated by tab
awk -F'\t' '($3=="111")'
perl -ne 'print if (split('\t'))[2]==111'
# extract lines where third field is "111" separated by tab
awk '($2=="1957") { print $3 }'
# extract third field where the second field is "1957"
For the last awk, I can not do the same with perl one liner.
I will add these to "Debian Reference", Chapter 8, tips.
Any one?
--
~\^o^/~~~ ~\^.^/~~~ ~\^*^/~~~ ~\^_^/~~~ ~\^+^/~~~ ~\^:^/~~~ ~\^v^/~~~ +++++
Osamu Aoki <osamu@debian.org> Cupertino CA USA, GPG-key: A8061F32
.''`. Debian Reference: post-installation user's guide for non-developers
: :' : http://qref.sf.net and http://people.debian.org/~osamu
`. `' "Our Priorities are Our Users and Free Software" --- Social Contract
Reply to: