Re: man sections

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

 



On 24Dec2014 06:50, Paul Cartwright <pbcartwright@xxxxxxxxx> wrote:
On 12/23/2014 05:19 PM, Cameron Simpson wrote:
and just for grins, try
man awk... 2032 lines... and the example shows:

You're complaining that awk has documentation?
oh no! that just means there are lots of options, arguements.....
complex command:)

It is a whole programming language.

EXAMPLES
      Print and sort the login names of all users:
           BEGIN     { FS = ":" }
                { print $1 | "sort" }

um, so, how does awk work there??

That is an example awk program. I would expect to feed it the
/etc/passwd file as input.
I would usually grep password, looking for a specific name... nice to
have a sorted list though.

AWK's not doing the sorting there.

The real advantage (in this tiny example) is that awk splits lines into fields for you. Instead of using grep and writing special regexps to get fields (tedious for anything except the first field), if you use:

 awk -F: 'program-text-here...' /etc/passwd

then the login field is $1 and so on. Then you can work more directly and readably.

Cheers,
Cameron Simpson <cs@xxxxxxxxxx>

Don't have awk? Use this simple sh emulation:
   #!/bin/sh
   echo 'Awk bailing out!' >&2
   exit 2
- Tom Horsley <tahorsley@xxxxxxxxxxxxxx>
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org



[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