Assumming that your file is read through STDIN this script :
while (<>) {
print "$1\n" if /\s*(\w+)\s+NS\s+.*/
#print what found in parens if the (current) line
# begins whith zero or more space/tab... one or
# more letter (we save it by enclosing it in parens)
# at least one space then the 2 letters NS followed
# by at least a space anf maybe other char
}
will do the job.
But
BEWARE I've made (far too many) assumptions here....
- NS is always uppercase (hint: see the i modifier otherwise)
- The domain name is always followed by NS (it seems to be the case in your example...)
- ...
Hope this helps in your regex learning...
You should may be edit your node and add some <BR> to make it more readable...