Sponsored Content
Full Discussion: Double echo problem
Top Forums Shell Programming and Scripting Double echo problem Post 302475648 by nocleader on Monday 29th of November 2010 11:34:06 AM
Old 11-29-2010
Double echo problem

I'm parsing a router configuration file and printing out some of the fields. Given the following output,
I'd like to add the filename to the first column. I'm definately a neophyte in scripting.


COUNTER=${#array1[*]}

while [ $COUNTER -ne -1 ]; do
######## echo -n $JUNOS_FILE | awk '{ printf "%-20s" , $0 }'
echo ${array0[$COUNTER]} | awk '{ printf "%-20s" , $1 }'
echo ${array3[$COUNTER]} | awk '{ printf "%-50s" , $0 }'
echo ${array2[$COUNTER]} | awk '{ printf "%-20s \n" , $1 }'
let COUNTER=COUNTER-1
done

------------------------- OUTPUT ---------------------------------------------------------------

lo0 LB rtr-management 127.0.0.1/32
t1-1/0/1 TZ Unused
t1-1/0/0 S3/0/16:0 ATT 69DHZA382XXX 10.255.74.62/30
ge-0/0/3 GE Reserved for WAN
ge-0/0/2 GE ZZZ-Test 10.213.0.109/30
ge-0/0/1 GE Unused-ge-0/0/1
ge-0/0/0 GE ECD_28307_00 Juniper J2320 10.213.101.19/27

-----
-----

When I try to add the filename the I get an extra row on top that I don't want. Appears to be
the filename echos twice somehow.

Any ideas??



COUNTER=${#array1[*]}

while [ $COUNTER -ne -1 ]; do
echo -n $JUNOS_FILE | awk '{ printf "%-20s" , $0 }'
echo ${array0[$COUNTER]} | awk '{ printf "%-20s" , $1 }'
echo ${array3[$COUNTER]} | awk '{ printf "%-50s" , $0 }'
echo ${array2[$COUNTER]} | awk '{ printf "%-20s \n" , $1 }'
let COUNTER=COUNTER-1
done

------------------------- OUTPUT ---------------------------------------------------------------

router-config-1
router-config-1 lo0 LB rtr-management 127.0.0.1/32
router-config-1 t1-1/0/1 TZ Unused
router-config-1 t1-1/0/0 S3/0/16:0 ATT 69DHZA382XXX 10.255.74.62/30
router-config-1 ge-0/0/3 GE Reserved for WAN
router-config-1 ge-0/0/2 GE ZZZ-Test 10.213.0.109/30
router-config-1 ge-0/0/1 GE Unused-ge-0/0/1
router-config-1 ge-0/0/0 GE ECD_xxxxx_00 Juniper J2320 10.213.101.19/27
Double echo problem-script-troublejpg
Double echo problem-script-trouble-2jpg
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

echo problem

Hi, I have given the following statement in a script to put the values of variables (VAR1, VAR2,...) in a file. echo " $VAR1 $VAR2 $VAR3 $VAR4 $VAR5" >> filename But the output is not coming properly. Variables VAR5, VAR4 are replacing the first (VAR1, VAR2,..). I can't... (5 Replies)
Discussion started by: abrd600
5 Replies

2. UNIX for Dummies Questions & Answers

echo $ problem

Hi I am using tcsh. I want display in a file_1 like this. $VARIBALE I gave in a termianl > echo "\$VARIBALE" > file_1 Its not workning. It was giving VARIBALE: Undefined variable. I gave \ before $, but why it was giving undefined varible? Please help me. Thanks in advance (4 Replies)
Discussion started by: chaitubek
4 Replies

3. Shell Programming and Scripting

While read do, then echo, gives double output

Sorry about the title, but this should be fairly self-explanatory. My script seems to work, except that in the output, below, the first three lines are correct, but why does it print the additional lines 4, 5, & 6? Script: #!/bin/bash while read; do client="$(grep -m 1 Client | awk... (3 Replies)
Discussion started by: MrKen
3 Replies

4. Shell Programming and Scripting

Problem with echo *

Hello all, Please help with the below. I have a requirement where in I have to read a pattern and print it as shown below. Patterns will be as below. Input Output Pattern Should be printed as below with spaces such that I can awk. -*--* - * - - * *--**... (2 Replies)
Discussion started by: tenderfoot
2 Replies

5. Shell Programming and Scripting

Perl echo with double quotes

I need to echo a string that has double quotes in a Perl script. #!/usr/bin/env perl `echo Rule123 -comment \"blah blah\" >> $filename` I'd like to get below appended to $filename: Rule 123 -comment "blah blah" But instead, the double quotes are lost: Rule 123 -comment blah bah ... (1 Reply)
Discussion started by: slchin
1 Replies

6. Shell Programming and Scripting

Using echo to print double quotes along with variable substitution

Hi, I am generating html code using cshell, but i am having one problem while printing double quotes, I need to write following code in file. where $var contains list of web address <a href="$var">$var</a> So i am using echo "<a href="$var">$var</a>" > file.html But with this " in... (4 Replies)
Discussion started by: sarbjit
4 Replies

7. Shell Programming and Scripting

echo problem

hi all i have little problem below is my shell script a=`sqlplus fss_cst/fss_cst@dolp1 << EOF SET PAGESIZE 0 FEEDBACK OFF TRIMOUT ON; select process from lfs$ta_process where valid_to_dat=to_date('9/16/2010','mm/dd/yyyy'); EOF` echo ${SQL} the script name is test2.sh when i execute... (5 Replies)
Discussion started by: aishsimplesweet
5 Replies

8. Shell Programming and Scripting

[Solved] echo not updating double quotes in output

Hi , I have a script to update firefox proxy. But the echo is not updating the double quotes. paste /home/names.txt /home/ip.txt | while read i j do mkdir $i echo "user_pref("network.proxy.http", "$j");" >> /home/$i/prefs.js echo "user_pref("network.proxy.http_port", 8080);" >>... (3 Replies)
Discussion started by: ranjancom2000
3 Replies

9. Shell Programming and Scripting

Double quotes and variable proble in echo

HI Guys, I want to echo below line in my file :- lpd | grep AL | nawk '{print "1dLA - " $0} How can i echo same Output (4 Replies)
Discussion started by: pareshkp
4 Replies

10. Shell Programming and Scripting

Printing double quotes in echo command

Please help me to use echo or printf type of command to print some value from variable within double quotes - I want to print the double quote ( " ") also. I tried #!/bin/bash VALUE=some_value echo '{"value" : "$VALUE"}' I was expecting the above script would produce .. {"value" :... (3 Replies)
Discussion started by: atanubanerji
3 Replies
rdpd(1M)																  rdpd(1M)

NAME
rdpd - router discovery protocol daemon (OBSOLETE) SYNOPSIS
| | DESCRIPTION
the router discover protocol daemon, implements the host portion of the router discovery protocol (see More specifically o solicits router advertisements when it is first started so as to populate the kernel table as soon as possible. o listens on all ethernet interfaces (that are up) for ICMP router advertisement datagrams. o adds a default router to the kernel table based on whether the router is a neighbor and has the highest preference among all advertisements received. o ages the default router entry applied to the kernel table based on the lifetime value found in the advertisement message. can be started during boot-time initialization. To do so, see (But see below.) Options supports the following options: Display the version of Enable tracing of the following events: o setting of expiration timer for advertised entry. o expiration of a router advertisement entry (only the active entry has a timer running). o add/update of an advertised router to the kernel. o removal from kernel table of an advertised router. o reception of a router advertisement from the link. o transmission of a router solicitation message. o failure while attempting to transmit a solicitation. Enable verbose tracing, which in addition to the above, traces: o contents of the router advertisement message received. o contents of rdpd internal statics which includes: 1. total number of messages received, 2. total number advertisements received, 3. total number of advertisements with invalid number of addresses field, 4. total number of advertisements with invalid address size field, 5. total number of advertisements with invalid message lengths, 6. total number of advertisements with invalid lifetime fields, 7. total number of messages with number of bytes received <> header length field. LIMITATIONS
1. The maximum number of default routes retained is 10. Only one of which is applied to the kernel routing tables (the one with the high- est preference). In the event that the advertised router with the highest preference expires the retained advertised router list will be searched for the highest preference, still current entry and that entry will be applied to the kernel table. This allows for quick recovery from aged advertisements. 2. only becomes aware of link state changes when either a new Router Advertisement message is received or a timer pops to age a currently active default router added by This may cause a delay between an interface state change (e.g., down) and any necessary change to the kernel routing table. 3. The "all hosts on subnet" broadcast address is used for sending solicitations instead of either the all-routers multicast or limited- broadcast IP addresses. 4. The limited-broadcast address for inbound Advertisements is assumed. 5. Default routers added via the command can be altered due to Router Advertisements for the same router. 6. Adding default routes via the command can cause unpredictable results and should be avoided. OBSOLESCENCE
The functionality of has been subsumed in See the statements described in gated.conf(4). has been obsoleted in HP-UX 11i Version 2. WARNINGS
should not be used if is enabled when running AUTHOR
was developed by HP. SEE ALSO
gated(1M), gated.conf(4). [1] Deering, S., "ICMP Router Discovery Messages", RFC 1256 rdpd(1M)
All times are GMT -4. The time now is 05:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy