Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 3, the unsupported old release. You're almost certainly looking for [[/eggref/4/awk|the CHICKEN 4 version of this egg]], if it exists. If it does not exist, there may be equivalent functionality provided by another egg; have a look at the [[https://wiki.call-cc.org/chicken-projects/egg-index-4.html|egg index]]. Otherwise, please consider porting this egg to the current version of CHICKEN. [[tags: egg]] == awk [[toc:]] === Description A looping construct for processing input in a way similar to the {{awk}} tool. === Author Originally by Olin Shivers. This implementation has been taken from [[http://docs.plt-scheme.org/mzlib/mzlib_awk.html|PLT Scheme's awk library]] and minimally modified by [[/users/felix winkelmann|felix winkelmann]] to work with Chicken. === Requirements None === Download [[http://code.call-cc.org/legacy-eggs/3/awk.egg|awk.egg]] === Documentation See [[http://www.scsh.net/docu/html/man-Z-H-9.html#node_sec_8.2|the SCSH documentation for {{awk}}]]. === Examples Count non-comment lines in Scheme file: <enscript highlight="scheme"> (use awk) (print (awk (read-line) (line) ([nlines 0]) ("^[ \t]*;" nlines) (else (add1 nlines))) </enscript> Strip blank lines: <enscript highlight="scheme"> (use awk) (awk (read-line) (line) () ("[^ \t]" (print line)) ) </enscript> Compute maximal line length: <enscript highlight="scheme"> (use awk) (print (awk (read-line) (line) ([max-len 0]) (#t (max max-len (string-length line))))) </enscript> Sort /etc/passwd file: <enscript higlight="scheme"> (use awk) (define (read-passwd . port) (let ([line (apply read-line port)]) (if (eof-object? line) (values line #f) (values line (string-split-fields ":" line #:infix))))) (for-each (lambda (entry) (print (cdr entry))) (sort (awk (read-passwd) (line fields) ([ans '()]) (#t (cons (cons (car fields) line) ans)) ) (lambda (x y) (string<? (car x) (car y))))) </enscript> === Changelog * 1.1 Adapted to new setup scheme * 1.0 Initial release === License PLT Software Copyright (c) 1995-2002 PLT PLT software is distributed under the GNU Lesser General Public License (LGPL).
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you subtract 2 from 10?