Simple string filters and replacement can be performed using grep
.
However, grep
doesn't work very nicely when it comes to strip out multiline strings or when the string you can to strip has different anchor points.
For example, if you never want to display the disclaimer, this is a very hard task. Because every single registry prints out the disclaimer with a different formatting, in a different part of the response.
For such task, you need to either
- decompose the answer into pieces (parse) and strip out what you don't need, then output the string
- maintain a list of identifiers for every single part you want to strip out and use a custom script to remove that parts when they show up (that's more or less the approach the linux whois client is using to strip out the disclaimer when you pass the corresponding option from the command line).
In both cases, it's not a trivial task.