| Line | |
|---|
| 1 | #
|
|---|
| 2 | # Basic Regular Expression
|
|---|
| 3 |
|
|---|
| 4 | # kip comments
|
|---|
| 5 | $0 ~ /^#/ { next; }
|
|---|
| 6 |
|
|---|
| 7 | # skip those option specific to regexec/regcomp
|
|---|
| 8 | $2 ~ /[msnr$#p^]/ { next; }
|
|---|
| 9 |
|
|---|
| 10 | # skip empty lines
|
|---|
| 11 | $0 ~ /^$/ { next; }
|
|---|
| 12 |
|
|---|
| 13 | # debug
|
|---|
| 14 | #{ printf ("<%s> <%s> <%s> <%s>\n", $1, $2, $3, $4); }
|
|---|
| 15 |
|
|---|
| 16 | # subreg expresion
|
|---|
| 17 | NF >= 5 { next; }
|
|---|
| 18 |
|
|---|
| 19 | # errors
|
|---|
| 20 | NF == 3 {
|
|---|
| 21 | # gsub (/@/, ",");
|
|---|
| 22 | # it means empty lines
|
|---|
| 23 | gsub (/\"\"/, "");
|
|---|
| 24 | # escapes
|
|---|
| 25 | gsub (/\\\'/, "\\\'\'");
|
|---|
| 26 | # error in regex
|
|---|
| 27 | if (index ($2, "C") != 0)
|
|---|
| 28 | {
|
|---|
| 29 | if (index ($2, "b") != 0)
|
|---|
| 30 | printf ("2@%s@%s\n", $1, $3);
|
|---|
| 31 | }
|
|---|
| 32 | # erro no match
|
|---|
| 33 | else
|
|---|
| 34 | {
|
|---|
| 35 | if (index ($2, "b") != 0)
|
|---|
| 36 | printf ("1@%s@%s\n", $1, $3);
|
|---|
| 37 | }
|
|---|
| 38 | next;
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | # ok
|
|---|
| 42 | NF == 4 {
|
|---|
| 43 | # skip those magic cookies can't rely on echo to gnerate them
|
|---|
| 44 | if (match($3, /[NSTZ]/))
|
|---|
| 45 | next;
|
|---|
| 46 |
|
|---|
| 47 | # gsub (/@/, ",");
|
|---|
| 48 | # it means empty lines
|
|---|
| 49 | gsub (/\"\"/, "");
|
|---|
| 50 | # escape escapes
|
|---|
| 51 | gsub (/\\\'/, "\\\'\'");
|
|---|
| 52 |
|
|---|
| 53 | if (index ($2, "b") != 0)
|
|---|
| 54 | printf ("0@%s@%s\n", $1, $3);
|
|---|
| 55 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.