| Server IP : 127.0.1.1 / Your IP : 216.73.217.33 Web Server : Apache/2.4.58 System : Linux nepub 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /proc/thread-self/root/usr/share/doc/mawk/examples/ |
Upload File : |
#!/usr/bin/mawk -f
# $MawkId: nocomment.awk,v 1.3 2020/09/19 13:02:14 tom Exp $
# 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 }