/usr/share/doc/mawk/examples
NameSizeModeActions
ct_length.awk4070755editdlrm
decl.awk30440755editdlrm
deps.awk13060755editdlrm
eatc.awk4920755editdlrm
gdecl.awk27910755editdlrm
hcal140460755editdlrm
hical29600755editdlrm
nocomment.awk5900755editdlrm
primes.awk10580755editdlrm
qsort.awk10940755editdlrm
Edit: /usr/share/doc/mawk/examples/nocomment.awk (590B)
#!/usr/bin/mawk -f # remove C comments from a list of files # using a comment as the record separator # # this is trickier than I first thought # The first version in .97-.9993 was wrong BEGIN { # RS is set to a comment (this is mildly tricky, I blew it here RS = "/\*([^*]|\*+[^*/])*\*+/" ORS = " " getline hold filename = FILENAME } # if changing files filename != FILENAME { filename = FILENAME printf "%s" , hold hold = $0 next } { # hold one record because we don't want ORS on the last # record in each file print hold hold = $0 } END { printf "%s", hold }