Bash extracting name servers including if they are on new line, using whois -
Hi friends, I'm trying to remove name servers from websites, but I think that if the server is a new line As if I can do it like this happens ....
nserver: ns-a.somesite.com 176.195.2.100 nserver: ns-b.somesite.com 176.195 .2.101 But if so, then I can not do it:
nserver: ns-a.somesite.com 176.195.2.100 ns-b. Somesite.com 176.195.2.101 Ns-b.somesite.com 176.195.2.102 This is what I have done so far:
whois ebay.com | Grep -E "[SS] errors {0,1}:"
Name of the name server only:
whois ebay.com | Grep -E "Name Server" | Tr-d '' | | With GP's search criteria, Monkey may look like your output, but you should get it 99%. The way is there. For reference only, it will repeat lines with "name server", it will remove the spaces from the line, then it will divide the line by a colon and print the other element, which is the name server .
Renewed
Added for hard examples:
whois sans.edu | Tr-d '' | | Awk -F: '{if ($ 1 == "Name Server" & Length ($ 2) & gt; 0) Print $ 2; And if found ($ 0 == "name server:") = 1; And if (found == 1 & amp; Length ($ 0)> 0) print $ 0; Other found = 0} ' This is a little maser. After removing the empty space, we do the following in OK to make the awk:
- We are divided by colon.
- If $ 1 is equal to "nameserver" and length $ 2 & gt; 0 Then we print $ 2 (ebay.com example)
- Otherwise if the "name server:" (sans.edu example) line, we found a flag
= 1 - otherwise set the flag to 0 (say we have a 0 Character length is found)
Comments
Post a Comment