Echo question


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Echo question
# 1  
Old 05-17-2010
Echo question

How can I get the following to prompt me for new values for the dacsrtrspans?

example I want to change the span #, sinktermmod, sinktermport, srctermdev and srctermport to new values.

old:
Code:
ADD DACSRTRSPAN-1-840 SINKTERMMODULE=8 SINKTERMPORT=94 SRCTERMDEV=1 SRCTERMPORT=1 SPANTYPE=T1_2 SRCSPANEQ=T1_1 SINKSPANEQ=T1_1

ADD DACSRTRSPAN-1-841 SINKTERMMODULE=8 SINKTERMPORT=95 SRCTERMDEV=1 SRCTERMPORT=2 SPANTYPE=T1_2 SRCSPANEQ=T1_1 SINKSPANEQ=T1_1

to NEW:
Code:
ADD DACSRTRSPAN-1-600 SINKTERMMODULE=6 SINKTERMPORT=1 SRCTERMDEV=1 SRCTERMPORT=1 SPANTYPE=T1_2 SRCSPANEQ=T1_1 SINKSPANEQ=T1_1
ADD DACSRTRSPAN-1-601 SINKTERMMODULE=6 SINKTERMPORT=2 SRCTERMDEV=1 SRCTERMPORT=2 SPANTYPE=T1_2 SRCSPANEQ=T1_1 SINKSPANEQ=T1_1

by using a script

Code:
printf "\n\nAdd the packet backhaul connections
===================================\n" >> $outfile
for btsrtrgrp in `displayrc bts-$bts con | grep PKTBTSCON | awk '{print $1}' | grep "[0-9]\{1,4\}-[0-9]-[0-9]"`; do
 
   #   Determine if the connection has DACSRTRSPANs or AGNODESPANs
   if displayrc btsrtrgrp-${btsrtrgrp} con | grep $btsrtrgrp | grep DACSRTRSPAN > /dev/null; then
      #   Add DACSRTRSPAN(s)
      for dacsrtrspan in `displayrc btsrtrgrp-${btsrtrgrp} con | grep DACSRTRSPAN | sed 's/^.* \(DACSRTRSPAN\-[0-9]\{1,5\}\-[0-9]\{1,5\}\) .*$/\1/'`; do
         sinktmod=`displayrc $dacsrtrspan spanconf | grep BTSRTRGRP | awk '{print $8}' | cut -f1 -d"/" | sed 's/Dacs//'`
         sinktport=`displayrc $dacsrtrspan spanconf | grep BTSRTRGRP | awk '{print $8}' | cut -f2 -d"/"`
         srctdev=`displayrc $dacsrtrspan spanconf | grep BTSRTRGRP | awk '{print $4}'`
         srctport=`displayrc $dacsrtrspan spanconf | grep BTSRTRGRP | awk '{print $5}' | sed 's/physical\-//'`
         spantype=`displayrc $dacsrtrspan spanconf | grep BTSRTRGRP | awk '{print $2}'`
         srcspaneq=`displayrc $dacsrtrspan spanconf | grep BTSRTRGRP | awk '{print $6}'`
         sinkspaneq=`displayrc $dacsrtrspan spanconf | grep BTSRTRGRP | awk '{print $9}'`
         printf "ADD $dacsrtrspan SINKTERMMODULE=${sinktmod} SINKTERMPORT=${sinktport} SRCTERMDEV=${srctdev} SRCTERMPORT=${srctport} SPANTYPE=${spantype} SRCSPANEQ=${srcspaneq} SINKSPANEQ=${sinkspaneq}\n" >> $outfile
      done
      printf "."

Thanks

Last edited by pludi; 05-18-2010 at 02:04 AM.. Reason: code tags, please...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need simple echo question

Hi I want to use echo command as below echo 'dir=' $1 ' dir|file|home' i need output like below : echo 'dir=' $1 ' dir|file|home' pp13dff Output dir=pp13dff dir|file|home (4 Replies)
Discussion started by: asavaliya
4 Replies

2. Shell Programming and Scripting

Simple cat and echo question

Apologies, probably a really simple problem: I've got a text file (nh.txt) with this in it: user1 email1 email2 user2 email1 email2 etc With the following basic script: for tline in $(cat nh.txt) do echo "**********" echo $tline done ... (3 Replies)
Discussion started by: nelmo
3 Replies

3. Shell Programming and Scripting

Quick Question on Echo

Hey all, so I wrote a pretty simple script. It's viewable here: #!/bin/sh FILE=`ls $1` for filename in $FILE do echo $filename `echo $filename | tr e 5 ` doneSo, as you can see it gets the list from a command line specified directory. It then loops through, echoes the filename, and then... (7 Replies)
Discussion started by: lowExpectations
7 Replies

4. UNIX for Advanced & Expert Users

echo date question

Whats the difference between using date in these 2 methods? How exactly does the shell handle the first one different from the second one? $ echo $date $ echo $(date) Tue Aug 16 03:10:25 EDT 2011 (5 Replies)
Discussion started by: cokedude
5 Replies

5. UNIX for Dummies Questions & Answers

echo * question

Hi all and tks in advance I am working my way through 'Learning the bash Shell'. I cannot be sure if I really understand why "echo *" (my double quotes) returns all the files in the current directory. I get the * ( wildcard) expansion of "*", and I think I understand that "echo" returns it's... (5 Replies)
Discussion started by: mdeh
5 Replies

6. Shell Programming and Scripting

With that logic this echoes "echo". Question about echo!

echo `echo ` doesn't echoes anything. And it's logic. But echo `echo `echo ` ` does echoes "echo". What's the logic of it? the `echo `echo ` inside of the whole (first) echo, echoes nothing, so the first echo have to echo nothing but echoes "echo" (too much echoing :P):o (2 Replies)
Discussion started by: hakermania
2 Replies

7. OS X (Apple)

Question about cat and echo

Hello, I am trying to send text to a USB to serial adaptor and then to an external speech synthesizer. I tried using the cat and echo commands with no luck. I have gotten some audio output from my synthesizer using Kermit a terminal emulator, so I am pretty sure my synthesizer and my USB to serial... (1 Reply)
Discussion started by: jamesapp
1 Replies

8. Shell Programming and Scripting

An echo question

Why do get 0 when i enter " echo $? " (1 Reply)
Discussion started by: JamieMurry
1 Replies

9. UNIX for Dummies Questions & Answers

Simple 'echo' question

Hi, I would like to output the identical line to 2 text files, ie output='blah' echo $output > test1.txt echo $output > test2.txt Is there a way I could do that output with ONE command, ie output='blah' echo $output > test1.txt & test2.txt (I know that doesn't work) Thanks for any... (1 Reply)
Discussion started by: msb65
1 Replies

10. Shell Programming and Scripting

question about echo $$

hi all i have script echo $$ >tmp i understand thatecho $$ display some process id which is unique is that correct ? and my othere question is what is the maximum length that process-id can be ? the reason that i'm asking this is because i have a program which need to read the number of the... (1 Reply)
Discussion started by: naamas03
1 Replies
Login or Register to Ask a Question