Re: probleme with awk arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



thx


2011/10/18 Miner, Jonathan W (US SSA) <jonathan.w.miner@xxxxxxxxxxxxxx>

> From: users-bounces@xxxxxxxxxxxxxxxxxxxxxxx [users-bounces@xxxxxxxxxxxxxxxxxxxxxxx] 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@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines



--
PhD candidate in Computer Science
Address      
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux