For the Compleat Fan
Dmi
Posts: 408 Joined: Sat Jun 04, 2005 4:16 pm
Location: Russia
Contact:
Post
by Dmi » Fri Aug 19, 2005 11:16 pm
I wrote a small context to imitate awk operation
here is example:
Code: Select all
(awk (read-file "/etc/passwd")
(set 'FS ":")
(rawk S
("^ro" (println (F 0) " " (F 2)))
("^daem" (println (F 2) " " (F 0)))))
is analog for:
Code: Select all
$ awk -F: '
/^ro/{print $1,$3}
/^daem/{print $3,$1}
' /etc/passwd
here is the origin:
http://en.feautec.pp.ru/SiteNews/awklsp
WBR, Dmi
Dmi
Posts: 408 Joined: Sat Jun 04, 2005 4:16 pm
Location: Russia
Contact:
Post
by Dmi » Sat Aug 20, 2005 4:58 pm
Small changes in documentation.
Added function (rcase) - like (case) but for string pattern match.
WBR, Dmi
statik
Posts: 58 Joined: Thu Apr 14, 2005 1:12 am
Post
by statik » Sat Aug 20, 2005 5:56 pm
awsome.
-statik
Dmi
Posts: 408 Joined: Sat Jun 04, 2005 4:16 pm
Location: Russia
Contact:
Post
by Dmi » Sat Aug 20, 2005 11:37 pm
corrected predefined value for field separator.
statik: I found, that description is bigger than the code :-)
But... aren't (rawk) and (rcase) useful?
WBR, Dmi
pjot
Posts: 733 Joined: Thu Feb 26, 2004 10:19 pm
Location: The Hague, The Netherlands
Contact:
Post
by pjot » Sun Aug 21, 2005 8:30 am
Hi DMI,
My previous favorite language used to be AWK (now it's newLisp of course), so I find your experiments very interesting. For my job I still use AWK a lot. Now I can port some of my AWK stuff easily to newLisp.
Thanks!
Peter