fedora-users October 2011 archive
Main Archive Page > Month Archives  > fedora-users archives
fedora-users: RE: probleme with awk arguments

RE: probleme with awk arguments

From: Miner, Jonathan W (US SSA) <jonathan.w.miner_at_nospam>
Date: Tue Oct 18 2011 - 15:29:29 GMT
To: Community support for Fedora users <users@lists.fedoraproject.org>

> From: users-bounces@lists.fedoraproject.org [users-bounces@lists.fedoraproject.org] On Behalf Of Adel ESSAFI
> [adel@localhost ~]$ C=g
> [adel@localhost ~]$ awk -v c=$C '{ print $c }' coran.pls

Drop the dollar sign from the awk print statement...

awk -v C=$C '{print c}' coran.pls

The dollar sign references the FIELD on the input. So $c will display the c'th field of the line; a more familiar example is NF, or the number of fields. By itself, NF, prints a number, but $NF prints the last field on the line.
-- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines