Nslookup how to remove interactive prompt


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Nslookup how to remove interactive prompt
# 1  
Old 06-04-2013
Nslookup how to remove interactive prompt

I am running this command

Code:
$ echo -en "set q=any\nwww.google.com\nexit\n" | nslookup | grep AAAA
> > > www.google.com    has AAAA address 2607:f8b0:400c:c01::93

Can someone help to remove displaying these "> " characters

Last edited by Scrutinizer; 06-04-2013 at 04:25 PM.. Reason: code tags
# 2  
Old 06-04-2013
Code:
echo -en "set q=any\nwww.google.com\nexit\n" | nslookup 2>/dev/null | grep AAAA

Also, echo -e isn't portable, I suggest printf, which is:

Code:
printf "set q=any\nwww.google.com\nexit\n" | nslookup 2>/dev/null | grep AAAA

# 3  
Old 06-04-2013
Most nslookup support command line options:

Code:
$ nslookup -query=any www.google.com | grep AAAA
www.google.com  has AAAA address 2404:6800:4006:804::1012

# 4  
Old 06-04-2013
you guys are awesome !!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How do I remove or hide SunOS version/release from remote login prompt?

For any SunOS 5.XX release, it appears prior to the "login:" prompt (as if a "uname" command is run). Would anyone know where that initial display of SunOS release comes from upon a remote login and how I can stop if from displaying? Thank you (4 Replies)
Discussion started by: ssid61
4 Replies

2. Solaris

Unable to move from rsc prompt to ok prompt

Hi, on sunfire v890 unable to move from rsc prompt to ok prompt, i have executed the command break. (9 Replies)
Discussion started by: manoj.solaris
9 Replies

3. Emergency UNIX and Linux Support

Nslookup!!! Please look up!!!

Hi all Nslookup command returns!!!! Code: nslookup 10.91.44.29 Server: 127.0.0.1 Address: 127.0.0.1#53 29.44.91.in-addr.arpa name = station1.example.com Code: nslookup station1.example.com Server: 127.0.0.1 Address: 127.0.0.1#53 Name: ... (4 Replies)
Discussion started by: anishkumarv
4 Replies

4. Shell Programming and Scripting

nslookup: am I doing it right?

Hi guys, I'm back to get some help again :) I have a file that has a list of IP addresses, and I use nslookup in my script to resolve hostnames of those IPs. the problem I'm facing is that I not all the hostnames got resolved! and I don't know why. sometimes the same duplicate IP returns a... (8 Replies)
Discussion started by: Abdulelah
8 Replies

5. Shell Programming and Scripting

Expect, save to file and remove before prompt

I have an Expect script which works very well. It logs into my remote routers and runs some commands and then to the next until finished. I need two things, first I need to save the output to a file from where the log_user 1 begins. expect << EOF set timeout 15 #set var "exit " match_max... (1 Reply)
Discussion started by: numele
1 Replies

6. Homework & Coursework Questions

How to write script that behaves both in interactive and non interactive mode

Q. Write a script that behaves both in interactive and non interactive mode. When no arguments are supplied it picks up each C program from the directory and prints first 10 lines. It then prompts for deletion of the file. If user supplies arguments with the script , then it works on those files... (8 Replies)
Discussion started by: rits
8 Replies

7. Homework & Coursework Questions

Help with Interactive / Non Interactive Shell script

Q. Write a script that behaves both in interactive and non interactive mode. When no arguments are supplied it picks up each C program from the directory and prints first 10 lines. It then prompts for deletion of the file. If user supplies arguments with the script , then it works on those files... (1 Reply)
Discussion started by: rits
1 Replies

8. UNIX for Advanced & Expert Users

nslookup for Unix

I am connecting from windows via Putty to some other Unix server. How can I display my current windows MachineName/NTID in putty? Thanks :) (4 Replies)
Discussion started by: som.nitk
4 Replies

9. Solaris

rm -r does not disable interactive prompt

For some reason, when I try to delete files using rm -r, it doesn not disable the interactive prompt. Any ideas? I am on a sun solaris 10 box. (9 Replies)
Discussion started by: mrx1350
9 Replies

10. IP Networking

nslookup strangness

hi, what would cause the nslookup to work one way but not the other? for most machine it works both ways. >nslookup 172.18.10.235 Server: 172.16.17.3 Address: 172.16.17.3#53 235.10.18.172.in-addr.arpa name = machine1.prod.local >nslookup machine1 Server: ... (3 Replies)
Discussion started by: purest
3 Replies
Login or Register to Ask a Question