-1

i have tried running the whois command from the linux machine i get the result as i desired in terminal and the web but the result is quite tedious and long.Is there any way i could filter the output result means in the following link

http://network-tools.com/

while doing the whois scan i want to remove displaying the creation and updated date and also the notice paragraph.How could i perform these activites.

user3101586
  • 25
  • 1
  • 5

2 Answers2

0

You can use grep to pull out specific lines or exclude specific lines. For example:

# Show only lines containing "abc"
whois example.ex | grep -F abc

# Show only lines that don't contain "abc"
whois example.ex | grep -Fv abc
Zenexer
  • 18,788
  • 9
  • 71
  • 77
0

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.

Simone Carletti
  • 173,507
  • 49
  • 363
  • 364
  • It requires a little bit of work and any example would be useless because you would have to rewrite it in any case depending on the TLD(s) you want to work with. You are encouraged to start working on the code and then come back to SO in case you have some issue with the specific code. – Simone Carletti Dec 21 '13 at 09:45