here is an alternative approach using sed instead of perl:
sed -e '/^[=]+NEXT SERVICE FINGERPRINT/,/^----/{d;}'
The format that nmap dumps seems to have changed since the original post. I'm seeing results that look like this:
| fingerprint-strings:
| GetRequest:
| HTTP/1.0 200 OK
--- (lines removed for brevity) ----
| <meta charset="UTF-8">
|_ <!-- safari rejects 3rd party cookies when running inside iframe so all client requests must include customer id in
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port443-TCP:V=7.94SVN%T=SSL%I=7%D=12/6%Time=6753D374%P=x86_64-pc-linux-
SF:gnu%r(GetRequest,1000,"HTTP/1\.0\x20200\x20OK\r\nAccept-Ranges:\x20byte
---- (lines removed for brevity) ----
SF:0client\x20requests\x20must\x20include\x20customer\x20id\x20in");
Here is a sed that removes these:
sed -e '/^| fingerprint-strings:/,/^|_/{d;}' -e '/^SF[-:]/{d;}' -e '/please submit the following fingerprint/{d;}'
Here is how this latter sed works, looking at each expression (-e):
/a/,/b/ matches all lines between and including those that match "a" and "b". And {d;} is a command to delete the matching line. (Not all Unixes require the ; in {d;} but some do, so I use it. I don't think it breaks any versions of unix, but if this fails, try removing it.) So we remove everything between the lines that start with | fingerprint-strings: and |_ (Caret, ^, marks the start of a line.)
/^SF[-:]/ matches any line that starts with SF and either a - or : and again, we use {d;} to delete
- The last expression is similar to #2 but we don't require the string to be at the beginning of the line we want to delete.