linux_ws2122/awk/06-aufgabe.awk

30 lines
754 B
Awk
Raw Normal View History

2021-10-13 17:25:16 +00:00
#!/bin/awk
function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s }
function rtrim(s) { sub(/[ \t\r\n]+$/, "", s); return s }
function trim(s) { ; return rtrim(ltrim(s)); }
function validBool(s) {
if (s == "ja" || s == "nein") {
return "1";
} else {
return "0";
}
}
{
if (FNR > 1) {
if ( validBool($4) == "0" ) { next; }
if ( validBool($9) == "0" ) { next; }
if ( validBool($10) == "0" ) { next; }
if ( validBool($15) == "0" ) { next; }
if ( validBool($16) == "0" ) { next; }
if ( validBool($17) == "0" ) { next; }
if ( validBool($19) == "0" ) { next; }
if ( validBool($21) == "0" ) { next; }
if ( validBool($22) == "0" ) { next; }
if ( validBool($23) == "0" ) { next; }
}
print trim($0)
}