comp.lang.awk FAQ 
Author Message
 comp.lang.awk FAQ

Archive-name: computer-lang/awk/faq

Comp-lang-awk-archive-name: faq
Posting-Frequency: biweekly
Last-modified: 1997-Sep-21

Frequently Asked Questions == FAQ

========================================================================

Contents:

   1. Disclaimer
   2. Spam
   3. Can you answer my awk question?
   4. How can I add a FAQ and its answer to the FAQ list?
   5. What is awk?
   6. What well-maintained awk-compatible languages are there?
     6.1 nawk
     6.2 gawk
     6.3 mawk
     6.4 tawk
     6.5 mksawk
     6.6 awkcc
     6.7 awk2c
     6.8 a2p
   7. Where can I buy awk?
     7.1 AT&T (awk, awkcc)
     7.2 Thompson Automation (tawk)
     7.3 MKS (awk, can generate standalone interpreted .exe)
   8. Where can I get awk for free?  For what platforms?
     8.0 meta-answer
     8.1 the one true awk
     8.2 gawk
       8.2.1 gawk precompiled for MS-DOS or OS/2
       8.2.2 gawk precompiled for Macintosh
       8.2.3 jgawk (Japanese gawk)
       8.2.4 gawk.dll
     8.3 mawk
     8.4 awk2c
     8.5 various old binary-only distributions for MSDOS
     8.99 awkcc
   9. Why would anyone still use awk instead of perl?
  10. How can I learn awk?
  11. What are some other awk resources?
  12. How do I report a bug in gawk?
  13. What's wrong with gawk on Digital's OSF/1?
  14. How can I access shell or environment variables in an awk script?
    14.1 Environment variables in general
    14.2 Unix Shell Quoting
    14.3 ENVIRON and "env"|
    14.4 exporting environment variables back to the parent process
  15. Is there an easy way to determine if you have oawk or nawk?
  16. How does awk deal with multiple files?
    16.0 Version warning
    16.1 How can awk test for the existence of a file?
    16.2 How can I get awk to read multiple files?
    16.3 How can I tell from which file my input is coming?
    16.4 How can I get awk to open multiple files (selected at runtime)?
    16.5 How can I treat the first file specially?
    16.6 How can I explicitly pass in a filename to treat specially?
  17. How many elements were created by split()?
  18. How can I split a string into characters?
  19. How do I use tolower() in the SunOS nawk?
  20. How do I have dynamic-width printf strings, like C?
  21. Why doesn't "\\$" behave like /\\$/ ?
  22. What is gawk's exit code?
  23. How can I get awk to be case-insensitive?
  24. How can I force a numeric/non-numeric comparison?
  25. Why does { FS=":"; print $1 } not split the first record?
  26. Did ^ and $ and . change in gawk?
  27. Why doesn't awk 'begin {...}' work?
  98. Miscellaneous
  99. Credits

========================================================================

1. Disclaimer

Read at your own risk.  The current, previous, or original authors
make no claim as to fitness for any purpose or absence of any errors,
and offer no warranty.  Do not eat.

========================================================================

2. Spam

you wouldn't believe how much spam I get to this address.

========================================================================

3. Can you answer my awk question?

Probably not.  Please don't mail it to me.

Read the FAQ, and the materials pointed to by it, and if you can't find
an answer there, by all means post to the newsgroup.

A FAQ list is intended to reduce traffic on a newsgroup, not eliminate it.

========================================================================

4. How can I add a FAQ and its answer to the FAQ list?

Mail BOTH of them to me.  Then I can add them to the FAQ and it should
help people who have that same question later, as well as everyone who
reads the group, because they won't see it asked and answered so often.

I do not work on this FAQ every day, but I will try to get updates
incorporated in a timely manner.

========================================================================

5. What is awk?

awk is a programming language, named after its three original authors:

  Alfred V. Aho
  Brian W. Kernighan
  Peter J. Weinberger

they write:

``
  Awk is a convenient and expressive programming language that can be
  applied to a wide variety of computing and data-manipulation tasks.
''

the title of the book uses `AWK', but the contents of the book
use `awk' (except at the beginning of sentences, as above).  I
will attempt to do the same (except perhaps at the beginning of
sentences, as above).

most implementations of awk are interpreters which read your awk
source program and parse it and act on it directly.

some vendors have developed awk compilers which will produce an
`executable' that may be run stand-alone -- thus, the end user
does not have access to the source code.  there are also various
awk->C converters which allow you to achieve the same
functionality (by compiling the resulting C code later).

one of the most popular compilers, from Thompson Automation,
continues to be the subject of many positive posts in the group.

  [
    I don't really want to start a reviews section, but it may be
    appropriate.  I think it's of general interest, and a good thing
    for the FAQ, but I don't want to be given any grief by a negative
    review I didn't write just because I'm distributing it.

    if you have a review you'd like me to put a pointer to, please
    inform me -- I already have some pointers of this form listed.
  ]

========================================================================

6. What well-maintained awk-compatible languages are there?

  6.1 nawk
    AT&T's `new awk' -- probably nobody uses the `old awk' anymore.
    interpreter
    might NOT be well-maintained

  6.2 gawk
    from the GNU project
    interpreter

  6.3 mawk

    interpreter

  6.4 tawk
    from Thompson Automation
    interpreter
    compiler
    MS-Windows DLL

  6.5 mksawk
    interpreter
    compiler
    from Mortice Kern Systems

    an old version of mksawk is shipped as `nawk' on Ultrix and
    OSF/1.

  6.6 awkcc
    translator to C
    might NOT be well-maintained

  6.7 awk2c
    translator to C
    uses GNU awk libraries extensively, and is subject to GPL

  6.8 a2p
    translator to Perl
    comes with Perl
    doesn't handle multiple concatenations:  e.g., var="x" "y" "z"
      -> must be in pairs:  e.g.,  var=( "x" "y" ) "z"
    doesn't handle redirection:  e.g., { print("foo") > "bar" }
      -> no known workaround

========================================================================

7. Where can I buy awk?

7.1 AT&T (awk, awkcc)

  _The AWK Programming Language_ says:
    phone
      +1 201 522 6900 [is this number still valid?]
    and login as `guest'.

  < http://www.*-*-*.com/ ;
  < http://www.*-*-*.com/ ;
  < http://www.*-*-*.com/ ;
  < http://www.*-*-*.com/ ;

  these versions might NOT be well-maintained

7.2 Thompson Automation (tawk)

  < http://www.*-*-*.com/ ~thompson/tawk.html>

  < http://www.*-*-*.com/ ~thompson/>

  Thompson Automation Software
  5616 SW Jefferson
  Portland, OR   97221
  USA

  North America: 800-944-0139
  Phone: +1 503 224 1639
  Fax: +1 503 224 3230

7.3 MKS (awk, can generate standalone interpreted .exe)

  < http://www.*-*-*.com/ ;

  Mortice Kern Systems
  185 Columbia Street W
  Waterloo, ON
  N2L 5Z5
  Canada

  North America: 800-265-2797
  Phone: +1 519 884 2251
  Fax: +1 519 884 8861

========================================================================

8. Where can I get awk for free?  For what platforms?

  8.0 meta-answer
    Obtaining Awk and Perl
    < http://www.*-*-*.com/ ~churchh/awk-perl.html>

  8.1 the one true awk
    < http://www.*-*-*.com/ ;
    <ftp://netlib.bell-labs.com/netlib/research/awk.bundle.Z>

    This is the version of awk described in "The Awk Programming Language",
    by A. V. Aho, B. W. Kernighan, and P. J. Weinberger
    (Addison-Wesley, 1988, ISBN 0-201-07981-X).
    Changes, mostly bug fixes, are listed in FIXES.

  8.2 gawk
    NOTE:  gawk 3.0.2 has a per-record memory leak which is fixed
      in (the wide beta and later) of 3.0.3 .

    ftp.gnu.ai.mit.edu/pub/gnu/gawk*
    <ftp://ftp.gnu.ai.mit.edu/pub/gnu/>
    e.g.,
      <ftp://ftp.gnu.ai.mit.edu/pub/gnu/gawk-3.0.2.tar.gz>

      8.2.1 gawk precompiled for MS-DOS, Win32, or OS/2

        The djgpp collection contains a 32-bit DOS gawk, along with
        many GNU utilities which may be useful with gawk (djgpp ports
        understand long filenames on Windows 95):

        < http://www.*-*-*.com/ ;
        <ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp>

        32-bit DOS (djgpp), Win32, and 16-bit OS/2 and DOS versions are
        part of the GNUish project:

        < http://www.*-*-*.com/ ;
        <ftp://ftp.simtel.net/pub/simtelnet/gnu/gnuish/>
        < http://www.*-*-*.com/ ;
        < http://www.*-*-*.com/ ;

        32-bit OS/2, Win32, and DOS (emx) versions:

        < http://www.*-*-*.com/ ; (Germany)
        <ftp://ftp-os2.cdrom.com/pub/os2/lang/gnuawk.zip>          (US)

      8.2.2 gawk precompiled for Macintosh

        <ftp://ftp.funet.fi/pub/mac/programming/>
        <ftp://ezinfo.ethz.ch/mac/programming/>
        <ftp://ftp.uwtc.washington.edu/pub/Mac/Programming/>
        <ftp://ftp.eos.hokudai.ac.jp/pub/mac/util/Gawk/>
        <ftp://ftp.fu-berlin.de/mac/lang/MPW/>
        <ftp://Pascal.zedat.fu-berlin.de/mac/lang/MPW/>
        <ftp://ftp.cs.tu-berlin.de/pub/mac/lang/MPW/>
        <ftp://nic.switch.ch/software/mac/src/mpw_c/>

      8.2.3 jgawk (Japanese gawk)

        <ftp://ftp.eos.hokudai.ac.jp/pub/mac/util/jgawk/>

      8.2.4 gawk.dll

        < http://www.*-*-*.com/ ~walkerj/>
          Gawk 2.15.2 plus extensions
          + Read/Write functions for INI files
          + Read-only functions for DBF files
...

read more »



Sun, 12 Mar 2000 03:00:00 GMT  
 comp.lang.awk FAQ

Archive-name: computer-lang/awk/pointer
Comp-lang-awk-archive-name: pointer
Posting-Frequency: weekly
Last-modified: 1997-Sep-02
FAQ-Last-modified: 1997-Sep-21

Frequently Asked Questions == FAQ

comp.lang.awk is about the use of Awk on ALL computer platforms.

The comp.lang.awk FAQ list is posted frequently, with a long expiry time.
This article's References: header points to it.  Some sites on the World
Wide Web archive all Usenet posts, and should be able to find it for you.

Also, it is available from news.answers archives.

quoting the news.answers FAQ:

``
                    Where are *.answers archived?

  All of the *.answers newsgroups are archived in the periodic posting
archive on rtfm.mit.edu [18.181.0.24].  Postings are located in the
anonymous ftp directories /pub/usenet/alt.answers,
/pub/usenet/comp.answers, etc., and are archived by "Archive-name".
Other subdirectories of /pub/usenet contain periodic postings that may
not appear in *.answers (as well as most of the *.answers postings),
saved by Subject line rather than by Archive-name.

  If you do not have anonymous ftp access, you can access the archives
by mail server as well.  Send an E-mail message to

separate lines for more information.
''

The FAQ list for comp.lang.awk can be found on the Internet:
  <ftp://rtfm.mit.edu/pub/usenet/comp.lang.awk/faq>
  <http://www.faqs.org/faqs/computer-lang/awk/faq/>



Sun, 12 Mar 2000 03:00:00 GMT  
 comp.lang.awk FAQ

Archive-name: computer-lang/awk/pointer
Comp-lang-awk-archive-name: pointer
Posting-Frequency: weekly
Last-modified: 1997-Sep-02
FAQ-Last-modified: 1997-Sep-29

Frequently Asked Questions == FAQ

comp.lang.awk is about the use of Awk on ALL computer platforms.

The comp.lang.awk FAQ list is posted frequently, with a long expiry time.
This article's References: header points to it.  Some sites on the World
Wide Web archive all Usenet posts, and should be able to find it for you.

Also, it is available from news.answers archives.

quoting the news.answers FAQ:

``
                    Where are *.answers archived?

  All of the *.answers newsgroups are archived in the periodic posting
archive on rtfm.mit.edu [18.181.0.24].  Postings are located in the
anonymous ftp directories /pub/usenet/alt.answers,
/pub/usenet/comp.answers, etc., and are archived by "Archive-name".
Other subdirectories of /pub/usenet contain periodic postings that may
not appear in *.answers (as well as most of the *.answers postings),
saved by Subject line rather than by Archive-name.

  If you do not have anonymous ftp access, you can access the archives
by mail server as well.  Send an E-mail message to

separate lines for more information.
''

The FAQ list for comp.lang.awk can be found on the Internet:
  <ftp://rtfm.mit.edu/pub/usenet/comp.lang.awk/faq>
  <http://www.faqs.org/faqs/computer-lang/awk/faq/>



Sun, 19 Mar 2000 03:00:00 GMT  
 comp.lang.awk FAQ

Archive-name: computer-lang/awk/pointer
Comp-lang-awk-archive-name: pointer
Posting-Frequency: weekly
Last-modified: 1997-Sep-02
FAQ-Last-modified: 1997-Oct-07

Frequently Asked Questions == FAQ

comp.lang.awk is about the use of Awk on ALL computer platforms.

The comp.lang.awk FAQ list is posted frequently, with a long expiry time.
This article's References: header points to it.  Some sites on the World
Wide Web archive all Usenet posts, and should be able to find it for you.

Also, it is available from news.answers archives.

quoting the news.answers FAQ:

``
                    Where are *.answers archived?

  All of the *.answers newsgroups are archived in the periodic posting
archive on rtfm.mit.edu [18.181.0.24].  Postings are located in the
anonymous ftp directories /pub/usenet/alt.answers,
/pub/usenet/comp.answers, etc., and are archived by "Archive-name".
Other subdirectories of /pub/usenet contain periodic postings that may
not appear in *.answers (as well as most of the *.answers postings),
saved by Subject line rather than by Archive-name.

  If you do not have anonymous ftp access, you can access the archives
by mail server as well.  Send an E-mail message to

separate lines for more information.
''

The FAQ list for comp.lang.awk can be found on the Internet:
  <ftp://rtfm.mit.edu/pub/usenet/comp.lang.awk/faq>
  <http://www.faqs.org/faqs/computer-lang/awk/faq/>



Sun, 26 Mar 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. comp.lang.awk FAQ

2. comp.lang.awk FAQ

3. comp.lang.awk FAQ

4. comp.lang.awk FAQ

5. comp.lang.awk FAQ

6. comp.lang.awk FAQ

7. comp.lang.awk FAQ

8. comp.lang.awk FAQ

9. comp.lang.awk FAQ

10. comp.lang.awk FAQ

11. comp.lang.awk FAQ

12. comp.lang.awk FAQ

 

 
Powered by phpBB® Forum Software