dig-x: only part of the output is needed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting dig-x: only part of the output is needed
# 1  
Old 01-05-2011
dig-x: only part of the output is needed

Hi everyone,

how can I get the highlighted text only?

I am only concerned with the first line of the "
AUTHORITY SECTION" (in red).

Quote:
; <<>> DiG 9.6.2-P2-RedHat-9.6.2-4.P2.fc11 <<>> -x 173.194.37.104
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58891
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4

;; QUESTION SECTION:
;104.37.194.173.in-addr.arpa. IN PTR

;; ANSWER SECTION:
104.37.194.173.in-addr.arpa. 35692 IN PTR lhr14s02-in-f104.1e100.net.

;; AUTHORITY SECTION:
194.173.in-addr.arpa. 34043 IN NS NS3.GOOGLE.COM.
194.173.in-addr.arpa. 34043 IN NS NS1.GOOGLE.COM.
194.173.in-addr.arpa. 34043 IN NS NS2.GOOGLE.COM.
194.173.in-addr.arpa. 34043 IN NS NS4.GOOGLE.COM.

;; ADDITIONAL SECTION:
NS1.GOOGLE.COM. 289233 IN A 216.239.32.10
NS2.GOOGLE.COM. 289233 IN A 216.239.34.10
NS3.GOOGLE.COM. 289233 IN A 216.239.36.10
NS4.GOOGLE.COM. 289233 IN A 216.239.38.10

;; Query time: 12 msec
;; SERVER: 131.251.0.4#53(131.251.0.4)
;; WHEN: Wed Jan 5 23:39:01 2011
;; MSG SIZE rcvd: 231
thank you in advance
# 2  
Old 01-05-2011
Try...
Code:
awk '/AUTHORITY SECTION/{getline; print $NF}' file1

This User Gave Thanks to Ygor For This Post:
# 3  
Old 01-05-2011
Thanks for that Ygor, I am really thankful for that.

thank you very much
# 4  
Old 01-06-2011
thru sed..
Code:
sed -n '/AUTHORITY SECTION/{N;s/.* //p}' inputfile > outfile

# 5  
Old 05-23-2011
Quote:
Originally Posted by michaelrozar17
thru sed..
Code:
sed -n '/AUTHORITY SECTION/{N;s/.* //p}' inputfile > outfile

Hi michaelrozar, could you tell me how to tailor the above sed code to give the same output as?
Code:
grep -A 1  patt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Extract a part of grep output

Hi, On AIX 7 I have : grep 's_ohs_instance_loc' $CONTEXT_FILE <ohs_instance_loc oa_var="s_ohs_instance_loc">/u01/appl_top/env/fs1/FMW_Home/webtier/instances/EBS_web_env_OHS1</ohs_instance_loc> But I need only this part:... (4 Replies)
Discussion started by: big123456
4 Replies

2. Shell Programming and Scripting

Read file, send to dig, no output

From the command line I am running the following command: for i in $(awk '{print ($1)}' src-dst|uniq); do dig -x "$i" +short; done src-dst has a list of IP addresses. When this script is running and I do a ps -ef | grep dig, I see the proper dig command with IP addresses being run, but the... (2 Replies)
Discussion started by: phish
2 Replies

3. Shell Programming and Scripting

search needed part in text file (awk?)

Hello! I have text file: From aaa@bbb Fri Jun 1 10:04:29 2010 --____OSPHWOJQGRPHNTTXKYGR____ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline My code '234565'. ... (2 Replies)
Discussion started by: candyme
2 Replies

4. Shell Programming and Scripting

How to extract one part from whole output

Hi All, I am trying to write a small shell programming to get db2 database size info. The command I am going to use is- db2 "CALL GET_DBSIZE_INFO(?, ?, ?, -1)" and the output of above command generally is- Value of output parameters -------------------------- Parameter Name :... (4 Replies)
Discussion started by: NARESH1302
4 Replies

5. Shell Programming and Scripting

Cutting Part of Output

Hello all I'm using bourne shell and need to figure out how to cut out a specific portion of some output. For example, my output from my command is: 12.12.52.125.in-addr.arpa name = hostname.domain.main.gov I need to get just the "hostname.domain.main.gov" part. What I'm trying... (9 Replies)
Discussion started by: lee.n.doan
9 Replies

6. Shell Programming and Scripting

need a part of output data as output

HI Guys, I need some expert help.. i have this below data as input WHERE StartTime >= '2010-03-24 20:10:08' AND username in('abc_xxx_yyy_01') and output need is just in appreciate your help on this !!!! thanks you ... (8 Replies)
Discussion started by: nitinrp1
8 Replies

7. Solaris

How to capture only some part of output when command executed??

Hi, When I execute this command prtdiag -v output sample : System clock frequency: 160 MHZ Memory size: 4GB ==================================== CPUs ==================================== E$ CPU CPU CPU Freq Size ... (4 Replies)
Discussion started by: vijaysachin
4 Replies

8. UNIX for Dummies Questions & Answers

Dig command output?

all, i am newbie to dns bind . Any help is very appreciated. I am using dig command to view the records in the config. I am expecting the following comamnds to display all the A (Address records) in the zone data file. my zone data file looks like this ------------------- $ORIGIN . $TTL... (2 Replies)
Discussion started by: sujathab
2 Replies

9. Shell Programming and Scripting

Redirecting part of output to stdout

Hi, I am trying to execute a command like this: find ./ -name "*.gz" -exec sh -c 'zcat {} | awk -f parse.awk' \; >> output If I want to print the filename, i generally use the -print argument to the find command but when I am redirecting the output to a file, how can I print just the... (2 Replies)
Discussion started by: Legend986
2 Replies

10. UNIX for Dummies Questions & Answers

SA288-sun solaris for systemm admin8,part II pdf needed

Hi All, can any1 plz upload me the SA288-sun solaris for system admin8,part II pdf. I need to do the certification.................plz help me at the earliest Thanks to all (4 Replies)
Discussion started by: iliyas
4 Replies
Login or Register to Ask a Question