Sponsored Content
Top Forums Shell Programming and Scripting Redirect output to a different text file depending source of data Post 302672667 by spartan22 on Tuesday 17th of July 2012 10:10:02 AM
Old 07-17-2012
Quote:
Originally Posted by Corona688
Smilie

Which is which?
Input listed below. Sorry about that.

'ans_listzones channel=site1-ddns01 slave'

The site name (site1-ddns01) is dictated by the input file.

---------- Post updated 07-17-12 at 10:10 AM ---------- Previous update was 07-16-12 at 05:38 PM ----------

I figured it out. Here's what I did...


Code:
#!/bin/bash
# Name: DNS Master Slave Zone Dump
# Purpose: Script is responsible for determining which zones are in which view across the DNS platform.

#References text file that contains server names
while read i; do

#Creates text file named after server
echo "Master" > $i.txt

#list all zones in dns in the master db and outputs to text file
echo "ans_listzones channel=$i master >> $i.txt"

#creates seperation within the file for the slave zones
echo "Slave" >> $i.txt

#list all zones in dns in the slave db outputs to text file
echo "ans_listzones channel=$i slave >> $i.txt"

#ends scirpt and directs input file
done < dns

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

redirect output to file?

Hi: I am currently working on a program which requires direct its ouput to a file here is an example ./proram arg_1 arg_2 when program ends all output will be arg_2 file Is that possible I am not a bad programmer, However I am stuck there. Can anyone give a hint? Thanks SW (1 Reply)
Discussion started by: slackware
1 Replies

2. UNIX for Dummies Questions & Answers

Redirect output to a file

Ahhhrrrggg I'm having a brain fart... I want to take the output of a command and redirect it to a file... This works.... $ man cp | cat >> copy_help but this doesn't keytool -help |cat >> keytool_help It just produces... these lines... more keytool_help ] ... ... (11 Replies)
Discussion started by: jimmyc
11 Replies

3. UNIX for Dummies Questions & Answers

redirect output to a file name

Hi all!! is possible to assign the output of some command to filename, i.e. grep_output.txt Otherwise, I want to open a new file which name is inside another, how can I do it? Thanks a lot! (7 Replies)
Discussion started by: csecnarf
7 Replies

4. Shell Programming and Scripting

Insert text into file depending on variable

Hey guys , i have a variable with the contents ... NUMBER=4 and a test file with the contents 1248 1213 1214 1278 1200 3045 3444 2130 I want to execute a script that will produce the following output ( based on NUMBER=4) to be ... create 1248 (1 Reply)
Discussion started by: theshams
1 Replies

5. Shell Programming and Scripting

How to redirect output of ls to a file?

Hi All, I want to redirect only the file names to a new file from the ls -ltr directroy. how Can i do it. my ls -ltr output will be as below. -rwxr-xr-x 1 118 103 28295 Jul 26 2006 event.podl -rwxr-xr-x 1 118 103 28295 Jul 26 2006 xyz.podl I want my new file... (6 Replies)
Discussion started by: girish.raos
6 Replies

6. Shell Programming and Scripting

How to split a data file into separate files with the file names depending upon a column's value?

Hi, I have a data file xyz.dat similar to the one given below, 2345|98|809||x|969|0 2345|98|809||y|0|537 2345|97|809||x|544|0 2345|97|809||y|0|651 9685|98|809||x|321|0 9685|98|809||y|0|357 9685|98|709||x|687|0 9685|98|709||y|0|234 2315|98|809||x|564|0 2315|98|809||y|0|537... (2 Replies)
Discussion started by: nithins007
2 Replies

7. UNIX for Dummies Questions & Answers

Mapping a data in a file and delete line in source file if data does not exist.

Hi Guys, Please help me with my problem here: I have a source file: 1212 23232 343434 ASAS1 4 3212 23232 343434 ASAS2 4 3234 23232 343434 QWQW1 4 1134 23232 343434 QWQW2 4 3212 23232 343434 QWQW3 4 and a mapping... (4 Replies)
Discussion started by: kokoro
4 Replies

8. 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

9. 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

10. Shell Programming and Scripting

Compare output of UNIX command and match data to text file

I am working on an outage script and I run a command from the command line which tells me the amount of generator failures in my market. The output of this command only gives me three digits to identify the site by. I have a master list of all sites in a separate file, call it list.txt. If my... (7 Replies)
Discussion started by: jbrass
7 Replies
slave(3erl)						     Erlang Module Definition						       slave(3erl)

NAME
slave - Functions to Starting and Controlling Slave Nodes DESCRIPTION
This module provides functions for starting Erlang slave nodes. All slave nodes which are started by a master will terminate automatically when the master terminates. All TTY output produced at the slave will be sent back to the master node. File I/O is done via the master. Slave nodes on other hosts than the current one are started with the program rsh . The user must be allowed to rsh to the remote hosts without being prompted for a password. This can be arranged in a number of ways (refer to the rsh documentation for details). A slave node started on the same host as the master inherits certain environment values from the master, such as the current directory and the environ- ment variables. For what can be assumed about the environment when a slave is started on another host, read the documentation for the rsh program. An alternative to the rsh program can be specified on the command line to erl as follows: -rsh Program . The slave node should use the same file system at the master. At least, Erlang/OTP should be installed in the same place on both computers and the same version of Erlang should be used. Currently, a node running on Windows NT can only start slave nodes on the host on which it is running. The master node must be alive. EXPORTS
start(Host) -> start(Host, Name) -> start(Host, Name, Args) -> {ok, Node} | {error, Reason} Types Host = Name = atom() Args = string() Node = node() Reason = timeout | no_rsh | {already_running, Node} Starts a slave node on the host Host . Host names need not necessarily be specified as fully qualified names; short names can also be used. This is the same condition that applies to names of distributed Erlang nodes. The name of the started node will be Name@Host . If no name is provided, the name will be the same as the node which executes the call (with the exception of the host name part of the node name). The slave node resets its user process so that all terminal I/O which is produced at the slave is automatically relayed to the mas- ter. Also, the file process will be relayed to the master. The Args argument is used to set erl command line arguments. If provided, it is passed to the new node and can be used for a variety of purposes. See erl(1) As an example, suppose that we want to start a slave node at host H with the node name Name@H , and we also want the slave node to have the following properties: * directory Dir should be added to the code path; * the Mnesia directory should be set to M ; * the unix DISPLAY environment variable should be set to the display of the master node. The following code is executed to achieve this: E = " -env DISPLAY " ++ net_adm:localhost() ++ ":0 ", Arg = "-mnesia_dir " ++ M ++ " -pa " ++ Dir ++ E, slave:start(H, Name, Arg). If successful, the function returns {ok, Node} , where Node is the name of the new node. Otherwise it returns {error, Reason} , where Reason can be one of: timeout : The master node failed to get in contact with the slave node. This can happen in a number of circumstances: * Erlang/OTP is not installed on the remote host * the file system on the other host has a different structure to the the master * the Erlang nodes have different cookies. no_rsh : There is no rsh program on the computer. {already_running, Node} : A node with the name Name@Host already exists. start_link(Host) -> start_link(Host, Name) -> start_link(Host, Name, Args) -> {ok, Node} | {error, Reason} Types Host = Name = atom() Args = string() Node = node() Reason = timeout | no_rsh | {already_running, Node} Starts a slave node in the same way as start/1,2,3 , except that the slave node is linked to the currently executing process. If that process terminates, the slave node also terminates. See start/1,2,3 for a description of arguments and return values. stop(Node) -> ok Types Node = node() Stops (kills) a node. pseudo([Master | ServerList]) -> ok Types Master = node() ServerList = [atom()] Calls pseudo(Master, ServerList) . If we want to start a node from the command line and set up a number of pseudo servers, an Erlang runtime system can be started as follows: % erl -name abc -s slave pseudo klacke@super x -- pseudo(Master, ServerList) -> ok Types Master = node() ServerList = [atom()] Starts a number of pseudo servers. A pseudo server is a server with a registered name which does absolutely nothing but pass on all message to the real server which executes at a master node. A pseudo server is an intermediary which only has the same registered name as the real server. For example, if we have started a slave node N and want to execute pxw graphics code on this node, we can start the server pxw_server as a pseudo server at the slave node. The following code illustrates: rpc:call(N, slave, pseudo, [node(), [pxw_server]]). relay(Pid) Types Pid = pid() Runs a pseudo server. This function never returns any value and the process which executes the function will receive messages. All messages received will simply be passed on to Pid . Ericsson AB stdlib 1.17.3 slave(3erl)
All times are GMT -4. The time now is 06:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy