09-27-2008
Sed subsitution on loop output in shell script
I have a forloop which checks a log for a set of 6 static IP addresses and each IP found is logged to a file which is then mailed to me.
After the forloop I always have a text file that may contain up to 6 IP addresses or may contain 0.
What I want to do is substitute the IP addresses (if any) into their hostnames so that the mail is more readable.
I was trying to use sed to accomplish this but i was having trouble getting the right result.
Any tips on how to do this or is sed even the best tool to use?
Thanks
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
how much do you know on using the sed commands within a diff command? I'm currently using one long command when robot runs that... when the diff command is ran that the < and > signs at the beginning of each line are changed to the environment name that they came from... making it easier to... (2 Replies)
Discussion started by: anthreedhr
2 Replies
2. Shell Programming and Scripting
Hi all
Just wondering if someone can help me with this. I'm trying to write a script that processes the output of another file and prints only the lines I want from it.
This is only the second script I have written so please bare with me here. I have referred to the literature and some of the... (3 Replies)
Discussion started by: javathecat
3 Replies
3. Shell Programming and Scripting
Hi all
I run my program prog.c in the following way :
$ ./prog 1 > output.txt where 1 is a user defined initial value used by the program.
But now I want to run it for many a thousand initial values, 1-1000, and store all the outputs in different files.
Like
$ ./prog 1... (1 Reply)
Discussion started by: alice06
1 Replies
4. Shell Programming and Scripting
Hello everyone,
I need some assistance with what I thought would have been a very simple script.
Purpose of Script:
Script will parse through a source file and modify (search/replace) certain patterns and output to stdout or a file. Script will utilize a "control file" which will contain... (12 Replies)
Discussion started by: packetjockey
12 Replies
5. Shell Programming and Scripting
Hello,
Following my learning of shell scripting.. I got stuck yet again.
If I execute this command on terminal:
$ sed "s/off/on/g" file > fileAUX
I successfully change the text off to on from file to fileAUX.
But the same command is not working inside a shell script. I tested and... (2 Replies)
Discussion started by: quinestor
2 Replies
6. UNIX for Dummies Questions & Answers
I have this output from a loop
a11
1,2
3,4
5,6
7,8
12,8
5,4
3,6
a12
10,11
12,13
15,18
20,22
a13
... (3 Replies)
Discussion started by: maryre89
3 Replies
7. Shell Programming and Scripting
Hey guys,
I am VERY new to linux scripting and was wondering if you could help me with the following:
essentially the use case is the following...a service crashes and a script must be executed to rerun 3000 entries one at a time....your options are to do each of those manually, 1 at a time... (6 Replies)
Discussion started by: wrnganswr
6 Replies
8. Shell Programming and Scripting
Hi,
I am using ksh , when i try to use for loop i am getting the expected output.
$for variable in $(ps -fu user | grep -i something/ | grep -i something | grep -v grep | awk '{print $2}');do
> grep $variable /tmp/some_path/*/*
> done
when tried the below to remote server, getting... (4 Replies)
Discussion started by: karthikram
4 Replies
9. Shell Programming and Scripting
So I am writing a bash script that will search a file line by line for unix timestamps, store all of the timestamps into an array, then check how many of those timestamps were created within the last hour, and finally increment a counter every time it finds a timestamp created within the last hour.... (6 Replies)
Discussion started by: jsikarin
6 Replies
10. UNIX for Beginners Questions & Answers
Hi, I have a shell script which analyses the log folder for a specific string and throws me the output. I have used for loop since it does this in multiple servers. Now I want to save the output in a excel in the below format. Can someone please help?
The output which I get
Server1 : count... (14 Replies)
Discussion started by: srilaxman
14 Replies
LEARN ABOUT DEBIAN
ldns-test-edns
ldns-test-edns(1) General Commands Manual ldns-test-edns(1)
NAME
ldns-test-edns - test if dns cache supports EDNS and DNSSEC.
SYNOPSIS
ldns-test-edns [ -i ] { ip }
DESCRIPTION
ldns-test-edns tests a DNS cache and checks if it supports EDNS0 and DNSSEC types so that it can be used as a dnssec-enabled DNS cache. It
sends two queries to the cache, one for the root key and one for a DS record. These must succeed, the answer must have EDNS, that type and
signatures.
If the IP address is good for DNSSEC, it is printed with 'OK'. Otherwise short description is given of the failure. If OK is given, the
cache should be good to use as a cache for a local configured DNSSEC validator.
The tool assumes the root is signed and Sweden is signed. Also, the queries are sent with the CD flag, the tool does not check that the
results are validated, but that they can be validated.
OPTIONS
-i option enables a mode where the working IP addresses are printed after another, with no other explanations, and if none work or no IP
addresses are on the input, 'off' is printed.
ldns-test-edns takes one or more IP addresses, it checks them in turn. IPv4 and IPv6 addresses can be given. The exit value is for the
last checked IP address: 0 is OK, 1 is failure, 2 is some sort of network failure.
AUTHOR
Written by the ldns team as an example for ldns usage.
REPORTING BUGS
Report bugs to <ldns-team@nlnetlabs.nl>.
COPYRIGHT
Copyright (C) 2010 NLnet Labs. This is free software. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR-
POSE.
14 Dec 2010 ldns-test-edns(1)