Both codes not working for me.
whois nba.com| sed -n '/Registry Registrant ID:/,/Registrant
whois ymas.com| sed -n '/Registry Registrant ID:/,/Registrant
whois ymas.com.pt| sed -n '/Registry Registrant ID:/,/Registrant
whois ymas.com.pt| sed -n '/Registry Admin ID:/,/Admin Email:/p'
whois ymas.com.pt| sed -n '/Registry Tech ID:/,/Tech Email:/p' >
whois ymas.com.uy| sed -n '/Registry Registrant ID:/,/Registrant
whois ymas.com.uy| sed -n '/Registry Admin ID:/,/Admin Email:/p'
cat aa.sh|awk -F. '$2 == "com|" {print $0}'
cat aa.sh|awk -F. '$2 == "com" {print $0}'
Desired output
whois nba.com| sed -n '/Registry Registrant ID:/,/Registrant
whois ymas.com| sed -n '/Registry Registrant ID:/,/Registrant
If the separator is . then the field (#2 ) ends at the next . or at the end of the line.
You can do an ERE-search:
awk -F. '$2 ~ /com|/ {print $0}' aa.sh
or limit the search to the beginning of the field
awk -F. '$2 ~ /^com\|/ {print $0}' aa.sh
In the latter case I have escaped \| because | is a special ERE character unless at the very beginning or the very end or within [ ].
1 Like
cool,
this works for me
awk -F. '$2 ~ /^com\|/ {print $0}'
---------- Post updated at 10:51 AM ---------- Previous update was at 10:49 AM ----------
but there is what if,,,
waht if the "|" is not existing,
out code works only because of "|" it can fetsh easily
RudiC
March 18, 2015, 12:41pm
4
How about
awk '!/com\./' file
whois nba.com| sed -n '/Registry Registrant ID:/,/Registrant
whois ymas.com| sed -n '/Registry Registrant ID:/,/Registrant
---------- Post updated at 17:41 ---------- Previous update was at 17:40 ----------
... or even better
awk '/com[^.]/' file
whois nba.com| sed -n '/Registry Registrant ID:/,/Registrant
whois ymas.com| sed -n '/Registry Registrant ID:/,/Registrant
1 Like
this is not working on general
awk '!/com\./'
this is the right answer of all,
awk '/com[^.]/'
Still a
awk '/[.]com\|/'
or
awk '$2 ~ /[.]com\|/'
is more precise, just like the previous one with dot-separated fields.
--
A correction: the | should be escaped \| even at the beginning or end.
Otherwise certain awk versions match everything, and other awk versions give an ERE error.