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
XSetFontPath()															    XSetFontPath()

Name
  XSetFontPath - set the font search path.

Synopsis
  XSetFontPath(display, directories, ndirs)
	Display *display;
	char **directories;
	int ndirs;

Arguments
  display   Specifies a connection to an X server; returned from XOpenDisplay().

  directories
	    Specifies the directory path used to look for the font.  Setting the path to the empty list restores the default path defined for
	    the X server.

  ndirs     Specifies the number of directories in the path.

Description
  XSetFontPath() defines the directory search path for font lookup for all clients.  Therefore the user  should  construct  a  new  directory
  search  path	carefully  by adding to the old directory search path obtained by XGetFontPath().  Passing an invalid path can result in pre-
  venting the server from accessing any fonts.	Also avoid restoring the default path, since some other client may have changed the  path  on
  purpose.

  The  interpretation  of the strings is operating-system-dependent, but they are intended to specify directories to be searched in the order
  listed.  Also, the contents of these strings are operating system specific and are not intended to be used by client applications.

  An X server is permitted to cache font information internally, for example, it might cache an entire font from a file and not check on sub-
  sequent  opens of that font to see if the underlying font file has changed.  However, when the font path is changed the X server is guaran-
  teed to flush all cached information about fonts for which there currently are no explicit resource IDs allocated.

  The meaning of errors from this request is implementation-dependent.

Errors
  BadValue

See Also
  XCreateFontCursor(), XFreeFont(), XFreeFontInfo(), XFreeFontNames(),	XFreeFontPath(),  XGetFontPath(),  XGetFontProperty(),	XListFonts(),
  XListFontsWithInfo(), XLoadFont(), XLoadQueryFont(), XQueryFont(), XSetFont(), XUnloadFont().

Xlib - Fonts															    XSetFontPath()
All times are GMT -4. The time now is 09:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy