Sponsored Content
Top Forums Shell Programming and Scripting Digcheck SH script. Only want to see MX output. Post 302307108 by spartan22 on Tuesday 14th of April 2009 03:25:12 PM
Old 04-14-2009
Digcheck SH script. Only want to see MX output.

I want to filter out all the junk and only see the Domain name and Mx records. Can't quite figure out how to get this output.

This is what i'm using to get the output.

Code:
dig mx -f domains.txt > mx.txt

This is what i see when i open the text file

Code:
; <<>> DiG 9.2.4 <<>> jjenkinsonline.com
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2550
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 0

;; QUESTION SECTION:
;jjenkinsonline.com.		IN	MX

;; ANSWER SECTION:
jjenkinsonline.com.	3593	IN	MX	10 mailstore1.secureserver.net.
jjenkinsonline.com.	3593	IN	MX	0 smtp.secureserver.net.

;; AUTHORITY SECTION:
jjenkinsonline.com.	3581	IN	NS	ns22.domaincontrol.com.
jjenkinsonline.com.	3581	IN	NS	ns21.domaincontrol.com.

;; Query time: 0 msec
;; SERVER: 172.24.36.46#53(172.24.36.46)
;; WHEN: Tue Apr 14 16:16:26 2009
;; MSG SIZE  rcvd: 152

; <<>> DiG 9.2.4 <<>> 4miles.com
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11463
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 13, ADDITIONAL: 1

;; QUESTION SECTION:
;4miles.com.			IN	MX

;; ANSWER SECTION:
4miles.com.		3593	IN	MX	10 mail.4miles.com.

;; AUTHORITY SECTION:
com.			172781	IN	NS	J.GTLD-SERVERS.NET.
com.			172781	IN	NS	K.GTLD-SERVERS.NET.
com.			172781	IN	NS	L.GTLD-SERVERS.NET.
com.			172781	IN	NS	M.GTLD-SERVERS.NET.
com.			172781	IN	NS	A.GTLD-SERVERS.NET.
com.			172781	IN	NS	B.GTLD-SERVERS.NET.
com.			172781	IN	NS	C.GTLD-SERVERS.NET.
com.			172781	IN	NS	D.GTLD-SERVERS.NET.
com.			172781	IN	NS	E.GTLD-SERVERS.NET.
com.			172781	IN	NS	F.GTLD-SERVERS.NET.
com.			172781	IN	NS	G.GTLD-SERVERS.NET.
com.			172781	IN	NS	H.GTLD-SERVERS.NET.
com.			172781	IN	NS	I.GTLD-SERVERS.NET.

;; ADDITIONAL SECTION:
mail.4miles.com.	3593	IN	A	64.56.35.138

;; Query time: 0 msec
;; SERVER: 172.24.36.46#53(172.24.36.46)
;; WHEN: Tue Apr 14 16:16:26 2009
;; MSG SIZE  rcvd: 289

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Running a script in system() call and want the script's output

Hi All, I have a script(sample.sh) displaying the output of "dd" command. Now i am using this script in system() call as, system("sh sample.sh") in an application file. I want the output of system("sh sample.sh") in the application file itself. How can i get it? Many thnaks.... (9 Replies)
Discussion started by: amio
9 Replies

2. Red Hat

Cron task output is 0, script output is OK

I have the following cron task set to run every 15 minutes to ascertain how many users are in the system and append the result to the log. /home/pronto/cus/whoisinc >> /home/pronto/cus/whoisin.log This is the whoisinc script date +"%d-%m-%Y,%k:%M,Pronto Users,`prowho -s | grep -v... (1 Reply)
Discussion started by: scottm
1 Replies

3. Shell Programming and Scripting

Awk script to run a sql and print the output to an output file

Hi All, I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file. Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
Discussion started by: adept
4 Replies

4. Shell Programming and Scripting

Need bash script to ping the servers and rename the output file each time the script is ran

HI, I have a file serverlist in that all host names are placed. i have written a small script #./testping #! /bin/bash for i in `cat serverlist` do ping $i >> output.txt done so now it creates a file output.txt till here fine.. now each time i run this script the output file... (4 Replies)
Discussion started by: madhudeva
4 Replies

5. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

6. Shell Programming and Scripting

Redirect script output to a file and mail the output

Hi Guys, I want to redirect the output of 3 scripts to a file and then mail the output of those three scripts. I used below but it is not working: OFILE=/home/home1/report1 echo "report1 details" > $OFILE =/home/home1/1.sh > $OFILE echo... (7 Replies)
Discussion started by: Vivekit82
7 Replies

7. Shell Programming and Scripting

Need output of script on screen and file with correct return status of the called script.

Hi, I am trying to capture logs of the script in the file as well as on the screen. I have used exec and tee command for this. While using exec command I am getting the correct output in the file but, script output is not getting displayed on the screen as it get executed. Below is my sample... (14 Replies)
Discussion started by: Prathmesh
14 Replies

8. Shell Programming and Scripting

Shell Script function to use script name for log file output

Hi Team - I"m very new to Shell Scripting so I have a rather novice question. My forte is Windows Batch Scripting so I was just wondering what the Shell Script equivalent is to the DOS command %~n? %~n is a DOS variable that dispayed the script name. For instance (in DOS): REM... (11 Replies)
Discussion started by: SIMMS7400
11 Replies

9. Shell Programming and Scripting

A shell script to run a script which don't get terminated and send a pattern from the output by mail

Hi Guys, I am very new to shell script and I need your help here to write a script. Actually, I have a script abc.sh which don't get terminated itself. So I need to design a script to run this script, save the output to a file, search for a given string in the output and if it exists send those... (11 Replies)
Discussion started by: Sambit Sahu
11 Replies

10. UNIX for Beginners Questions & Answers

Shell script to call and sort awk script and output

I'm trying to create a shell script that takes a awk script that I wrote and a filename as an argument. I was able to get that done but I'm having trouble figuring out how to keep the header of the output at the top but sort the rest of the rows alphabetically. This is what I have now but it is... (1 Reply)
Discussion started by: Eric7giants
1 Replies
UNBUFFER(1)                                                   General Commands Manual                                                  UNBUFFER(1)

NAME
unbuffer - unbuffer output SYNOPSIS
unbuffer program [ args ] INTRODUCTION
unbuffer disables the output buffering that occurs when program output is redirected from non-interactive programs. For example, suppose you are watching the output from a fifo by running it through od and then more. od -c /tmp/fifo | more You will not see anything until a full page of output has been produced. You can disable this automatic buffering as follows: unbuffer od -c /tmp/fifo | more Normally, unbuffer does not read from stdin. This simplifies use of unbuffer in some situations. To use unbuffer in a pipeline, use the -p flag. Example: process1 | unbuffer -p process2 | process3 CAVEATS
unbuffer -p may appear to work incorrectly if a process feeding input to unbuffer exits. Consider: process1 | unbuffer -p process2 | process3 If process1 exits, process2 may not yet have finished. It is impossible for unbuffer to know long to wait for process2 and process2 may not ever finish, for example, if it is a filter. For expediency, unbuffer simply exits when it encounters an EOF from either its input or process2. In order to have a version of unbuffer that worked in all situations, an oracle would be necessary. If you want an application-specific solution, workarounds or hand-coded Expect may be more suitable. For example, the following example shows how to allow grep to finish pro- cessing when the cat before it finishes first. Using cat to feed grep would never require unbuffer in real life. It is merely a place- holder for some imaginary process that may or may not finish. Similarly, the final cat at the end of the pipeline is also a placeholder for another process. $ cat /tmp/abcdef.log | grep abc | cat abcdef xxxabc defxxx $ cat /tmp/abcdef.log | unbuffer grep abc | cat $ (cat /tmp/abcdef.log ; sleep 1) | unbuffer grep abc | cat abcdef xxxabc defxxx $ BUGS
The man page is longer than the program. SEE ALSO
"Exploring Expect: A Tcl-Based Toolkit for Automating Interactive Programs" by Don Libes, O'Reilly and Associates, January 1995. AUTHOR
Don Libes, National Institute of Standards and Technology 1 June 1994 UNBUFFER(1)
All times are GMT -4. The time now is 11:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy