Sponsored Content
Top Forums Shell Programming and Scripting How to transform a string to a variable? Post 302152278 by Kerstin on Wednesday 19th of December 2007 10:46:07 AM
Old 12-19-2007
I get the search path (ctl_file) from the lookup table:

if [ -z $8 ] ; then
ctl_file=$6
else
ctl_file=`sqlplus -S $1 << EOF
set heading off feedback off echo off verify off
select xxogl_f30_lookup.getValue('$8') from dual;
exit;
EOF`
fi


This gives e.g. ctl_file=$XXOGL_TOP/xxogl/org_rst.ctl
When I'm using this variable in the script I want "XXOGL_TOP" to be replaced by "/fd02/app/appl_top" which is already set.

Then I learned that I could use "eval". So I tried:
eval ctl_file=$ctl_file

But I then realized that it will try to evaluate also the contents of the file... Do I have to split the string $XXOGL_TOP/xxogl/org_rst.ctl to try to get rid of the file in the end? Or is there another way?


/Kerstin
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Use awk to log transform

Hello. I'm trying to use the awk command to convert certains fields to lgo base 2, not base 10. I'm trying command lines like: awk '$2 $5 $7 {print log(2)($2), log(2)($5), $7) filein.txt > fileout.txt I'm trying to make a deadline. Thanks for helping a newbie. Here's some fresh karma... (1 Reply)
Discussion started by: jmzcal
1 Replies

2. Shell Programming and Scripting

Search for string in a file and extract another string to a variable

Hi, guys. I have one question: I need to search for a string in a file, and then extract another string from the file and assign it to a variable. For example: the contents of the file (group) is below: ... ftp:x:23: mail:x:34 ... testing:x:2001 sales:x:2002 development:x:2003 ...... (6 Replies)
Discussion started by: daikeyang
6 Replies

3. Shell Programming and Scripting

Using sed to replace a string in file with a string in a variable that contains spaces

Hi, i call my shell like: my_shell "my project name" my script: #!/bin/bash -vx projectname=$1 sed s/'PROJECT_NAME ='/'PROJECT_NAME = '$projectname/ <test_config_doxy >temp cp temp test_config_doxy the following error occurres: sed s/'PROJECT_NAME ... (2 Replies)
Discussion started by: vivelafete
2 Replies

4. Shell Programming and Scripting

Appending string, variable to file at the start and string at end

Hi , I have below file with 13 columns. I need 2-13 columns seperated by comma and I want to append each row with a string "INSERT INTO xxx" in the begining as 1st column and then a variable "$node" and then $2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13 and at the end another string " ; COMMIT;" ... (4 Replies)
Discussion started by: Vaddadi
4 Replies

5. Shell Programming and Scripting

replace (sed?) a string in file with multiple lines (string) from variable

Can someone tell me how I can do this? e.g: a=$(echo -e wert trewt ertert ertert ertert erttert erterte rterter tertertert ert) How do i replace the STRING with $a? I try this: sed -i 's/STRING/'"$a"'/g' filename.ext but this don' t work (2 Replies)
Discussion started by: jforce
2 Replies

6. UNIX for Dummies Questions & Answers

Comparing a String variable with a string literal in a Debian shell script

Hi All, I am trying to to compare a string variable with a string literal inside a loop but keep getting the ./testifstructure.sh: line 6: #!/bin/sh BOOK_LIST="BOOK1 BOOK2" for BOOK in ${BOOK_LIST} do if then echo '1' else echo '2' fi done Please use next... (1 Reply)
Discussion started by: daveu7
1 Replies

7. Programming

STL transform question

Hi all, I pass to the transform algorithm two vectors, and the suma function. #include <algorithm> #include <iostream> #include <iterator> #include <vector> using namespace std; class Duo{ public: int one; int two; }; Duo suma(Duo first, Duo last){ Duo ret; ... (1 Reply)
Discussion started by: santiagorf
1 Replies

8. Shell Programming and Scripting

Transform columns to matrix

The following code transform the matrix to columns. Is it possible to do it other way around ( get the input from the output) ? input y1 y2 y3 y4 y5 x1 0.3 0.5 2.3 3.1 5.1 x2 1.2 4.1 3.5 1.7 1.2 x3 3.1 2.1 1.0 4.1 2.1 x4 5.0 4.0 6.0 7.0 1.1 output x1 y1 0.3 x2 y1 1.2 x3... (1 Reply)
Discussion started by: quincyjones
1 Replies

9. UNIX for Beginners Questions & Answers

Grep a sub-string from a string stored in a variable.

For example: I am grepping "Hello" from a file and there are 10 matches. So all ten lines with match will get stored into a variable($match). Now I want to ignore those lines which have "Hi" present in that. Currently I tried this: match = grep "Hello" file | grep -v "Hi" file But that's not... (2 Replies)
Discussion started by: pavan
2 Replies

10. UNIX for Beginners Questions & Answers

Check if string variable is a subset of another string variable

Below is my ksh shell script where I need to check if variable fileprops is a subset of $1 argument. echo "FILE PROPERTY: $fileprops" echo "PARAMETER3: $1" if ; then echo "We are Good. $line FILE is found to be INTACT !! " else echo... (2 Replies)
Discussion started by: mohtashims
2 Replies
mlib_ImageColorTrue2IndexInit(3MLIB)			    mediaLib Library Functions			      mlib_ImageColorTrue2IndexInit(3MLIB)

NAME
mlib_ImageColorTrue2IndexInit - initialization for true color to indexed color conversion SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ] #include <mlib.h> mlib_status mlib_ImageColorTrue2IndexInit(void **colormap, mlib_s32 bits, mlib_type intype, mlib_type outtype, mlib_s32 channels, mlib_s32 entries, mlib_s32 offset, const void **table); DESCRIPTION
The mlib_ImageColorTrue2IndexInit() function creates and initializes an internal data structure based on the input lookup table and other parameters for inverse color mapping. The lookup table can have either three or four channels. The number of channels of the lookup table should match that of the source image provided to the function that will use the colormap structure created by this function. The type of the lookup table can be one of the following: MLIB_BYTE in, MLIB_BYTE out (i.e., BYTE-to-BYTE) MLIB_SHORT in, MLIB_SHORT out (i.e., SHORT-to-SHORT) MLIB_SHORT in, MLIB_BYTE out (i.e., SHORT-to-BYTE) The input type of the lookup table should match the type of the destination image; the output type of the lookup table should match the source image type. The source and destination images are the images provided to the function that is going to use the colormap structure created by mlib_ImageColorTrue2IndexInit() to do inverse color mapping. PARAMETERS
The function takes the following arguments: colormap Internal data structure for inverse color mapping. bits Number of bits per color component used in the colorcube of the colormap structure. (If bits = 0, then no colorcube is created. But the inverse color mapping might be done by using the original lookup table.) intype Data type of the source image and lookup table. outtype Data type of the destination indexed image. channels Number of channels of the lookup table. entries Number of entries of the lookup table. offset The first entry offset of the lookup table. table The lookup table (LUT). RETURN VALUES
The function returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
mlib_ImageColorErrorDiffusion3x3(3MLIB), mlib_ImageColorOrderedDither8x8(3MLIB), mlib_ImageColorTrue2Index(3MLIB), mlib_ImageCol- orTrue2IndexFree(3MLIB), attributes(5) SunOS 5.11 2 Mar 2007 mlib_ImageColorTrue2IndexInit(3MLIB)
All times are GMT -4. The time now is 01:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy