Sponsored Content
Top Forums Shell Programming and Scripting Help cannot concatenate Ksh variables ? Post 302601288 by methyl on Thursday 23rd of February 2012 09:47:23 AM
Old 02-23-2012
SECOND SCRIPT. still contains original errors. Suggested changes in red.
Code:
#!/bin/ksh
#################################################################################
# This script uses grep and gets the working copy locations from the dnaRelowc1.dat file                            #
# and creates a script with the relocate command to relocate DNA build working copies from                      #
# the  svn01g.gdc.net server to the svnprod.nwie.net server.                                                                                #
#################################################################################
#
# Read the list of Subversion working copies directories to Relocate to new Subversion Server
OutputLoc="/scripts/dataout"
bldDirLoc="/webdata/tmpDNAbld/"
wcfiles=${OutputLoc}/dnaRelwc2.dat  
svnRelcmd="svn relocate"
set svnRelcmd

cd ${bldDirLoc}

cat "${wcfiles}" | while read i
do
    #get current host URL from each entries file
    OldRepo=`grep svn01g.gdc ${i}/.svn/entries | tail -1`
    #Replace each current host URL with New host URL
    NewRepo=`grep svn01g.gdc ${i}/.svn/entries | tail -1 | sed '/svn01g.gdc/ s/svn01g.gdc/svnprod/g' | sed 's/\/svn01p//g' | sed 's/\/Repositories//g'`
    #print line to change directory to each directory that contains the .svn(dotsvn) subdirectory (cd PATH)
    echo "cd $i"
    #print next line to execute command in each directory (svn relocate OldRepo NewRepo)
    echo "$svnRelcmd $OldRepo $NewRepo"
done

Apart from the form-feed characters which show as "\f" the input file looks ok.
The overwriting on the screen was caused by the "\c" in the "echo -e".

Last edited by methyl; 02-23-2012 at 10:50 AM.. Reason: fix layout
This User Gave Thanks to methyl For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

variables in ksh

I'm new to unix scripting. How would I go about pulling the first 3 characters from a variable in ksh and storing in another variable? Thanks. (9 Replies)
Discussion started by: steve6368
9 Replies

2. Shell Programming and Scripting

subtracting variables in ksh

hi all, how do i subract variables in shell ?? am trying to space out the headers and the output generated by the shell so they all line up : currently the output is like this : servers : users server1 : 10 latestServer : 50 so i thought... (3 Replies)
Discussion started by: cesarNZ
3 Replies

3. Shell Programming and Scripting

how to concatenate values of two variables with an underscore(_) in between

Hi, I'm new to shell programming. I have two variables a and b a=val1 b=val2 could anyone kindly post the shell script to concatenate the values of variable a and b with an underscore(_) in between? The final output should be val1_val2. (8 Replies)
Discussion started by: badrimohanty
8 Replies

4. Shell Programming and Scripting

How to preserve NL in Ksh variables?

I'm trying to set a variable to the output of a command. This is what the comand output to the display looks like: />hciconndump -v TOsiu Dump of connection(s): TOsiu ---------------------------------------------------------------------- Process: A60Tsiu Connection: TOsiu... (2 Replies)
Discussion started by: troym72
2 Replies

5. Shell Programming and Scripting

Combining two variables in ksh

I can't believe I can't figure this out... given this code: CARS_DATA_LIST=`cat /tmp/file1 | awk '{print $1}' ` FMSA_DATA_LIST=`cat /tmp/file2 | awk '{print $1}' ` The value of each of the above variables is: CARS = a b c d e f g FMSA = a b c q r s I want to declare a third... (8 Replies)
Discussion started by: Shoeless_Mike
8 Replies

6. Shell Programming and Scripting

concatenate variables problem

Hello, I have a tricky problem: I have a $file with a variable number of occurrences of "ORA-" (in this case two) .......... EXP-00008: ORACLE error 3113 encountered ORA-03113: end-of-file on communication channel EXP-00056: ORACLE error 1403 encountered ORA-01403: no data found... (9 Replies)
Discussion started by: Laurentiu
9 Replies

7. Shell Programming and Scripting

ksh - for loop with variables

Hi, I 'm trying to send an e-mail for every different line in the .txt for i in {1..$variable} do sed -n "/$i$/p" text.txt done I have two problems about this. First one is that for loop doesn't work and the second one is that i cant get the output of sed (4 Replies)
Discussion started by: ozum
4 Replies

8. Shell Programming and Scripting

concatenate variables

I need to know how to concatenate variables in Debian. I am making a interactive script where it ask the user for info to add a user I pull the first letter from the first middle and last name into individual variables now i want to put them all in one variable so i can put it into useradd command ... (4 Replies)
Discussion started by: HackerSeabass
4 Replies

9. UNIX for Dummies Questions & Answers

Formating variables in KSH

Hi Friends , I want to know how to format the output for the following: i searched in the forum and couldnt get the exact requirement. Thanks in advance . (2 Replies)
Discussion started by: i150371485
2 Replies

10. Shell Programming and Scripting

Concatenate two variables and form the third variable

Hi Guys, I was scratching my head for this for half a day... finally not successful :confused: Following is the problem I have a variable $ var1=123 $ var2-234 $ var3=345 and another Variable $ i=1 Now i wanted to save these into a Variable as shown below for i in 1 2 3 do... (5 Replies)
Discussion started by: ramprabhum
5 Replies
PMDISCOVERSERVICES(3)					     Library Functions Manual					     PMDISCOVERSERVICES(3)

NAME
pmDiscoverServices - discover PCP services on the network C SYNOPSIS
#include <pcp/pmapi.h> int pmDiscoverServices(const char *service, const char *mechanism, char ***urls); cc ... -lpcp DESCRIPTION
Given a PCP service name, as identified by service, and using the type of discovery optionally specified in mechanism, pmDiscoverServices returns, via urls, a list of URLs representing the services discovered on the network. service specifies the PCP service to be discovered. Currently, only PM_SERVER_SERVICE_SPEC is supported, which searches for pmcd(1) servers. mechanism specifies the style of discovery to be used. Currently, only "avahi" is supported. This searches for services which are broad- casting using mDNS via avahi-daemon(8). mechanism may also be NULL, which means to use all available discovery mechanisms. Normally, pmDiscoverServices will return the number of services discovered, else a value less than zero for an error. The value zero indi- cates that no services were discovered. The resulting list of pointers, urls, and the values (the URLs) that the pointers reference will have been allocated by pmDiscoverServices with a single call to malloc(3C), and it is the responsibility of the pmDiscoverServices caller to free(urls) to release the space when it is no longer required. When an error occurs, or no services are discovered, urls is undefined (no space will have been allocated, and so calling free(3C) is a singularly bad idea). PCP ENVIRONMENT
Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configura- tion file, as described in pcp.conf(5). Values for these variables may be obtained programmatically using the pmGetConfig(3) function. SEE ALSO
PMAPI(3), pmcd(1), pmfind(1), pmGetConfig(3), pcp.conf(5), pcp.env(5) and avahi-daemon(8). DIAGNOSTICS
EOPNOTSUPP The specified mechanism is not supported. Performance Co-Pilot PCP PMDISCOVERSERVICES(3)
All times are GMT -4. The time now is 01:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy