Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to pass the parameter value to a... ? Post 302496628 by Scott on Monday 14th of February 2011 04:51:54 PM
Old 02-14-2011
I don't think either solution worked, actually Smilie

Here's a fix for the sed one (which forgot to put the extension back on when there was a "dot"):
Code:
sed '
  s/\.cfg$/'"$1"'&/
  t
  s/$/'"$1"'/
 ' file

And for the shell one (which left a trailing "dot" when there was no extension):
Code:
X=${1:-1.0.0}
while IFS=. read NAME EXT; do
  echo $NAME$X${EXT:+.$EXT}
done < file

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Pass Parameter to Another Script

I have a piece of code that I do not want to continuously repeat. I want to call script2 from script1 and pass a parameter. Here is an example: Script1: ....... nohup ./Script2 PARAMETER ....... Script2: if # Checks if any params. then echo "No parameters passed to function." ... (4 Replies)
Discussion started by: rvprod
4 Replies

2. UNIX for Dummies Questions & Answers

PASS parameter to AWK

Hi, Can i pass a parameter(not a file name) as a parameter to a awk program? eg; $awk -f test 1 2 3 here test is the filename...and 1,2,3 are the i/p parameters? thank you:-) (2 Replies)
Discussion started by: unisam
2 Replies

3. Shell Programming and Scripting

Pass parameter into script

I would like to write a scirpt a.sh that it first checks the first parameter of the input. If it fulfill some condition ,then run an executable program b by using all the parameter. ie. > ./a.sh 10 20 30 40 50 Then a.sh first checks the first parameter, 10, if it mathes the requirement, then... (2 Replies)
Discussion started by: alfredo
2 Replies

4. Shell Programming and Scripting

How to pass a parameter

Hi all, How to pass a parameter from a oracle pl/sql procedure parameter to shell environment and use it? (1 Reply)
Discussion started by: megh
1 Replies

5. UNIX for Dummies Questions & Answers

How to pass parameter to subroutine

I have something like cp -p <dir>filename1.dat <dir2>filename1.dat there are many other operations in it I mean that filename1.dat will keep on changing I need to write a subroutine so that i can pass filename1 or 2 or 3 .dat as parameter Thanking you in advance Any help wuld be appreciated (2 Replies)
Discussion started by: ssuresh1999
2 Replies

6. Shell Programming and Scripting

How to pass a parameter from the terminal?

Hi, I am new in Ubuntu, I will be glud to know: 1. How to pass a parameter from the terminal to a file that I write in shell script. What is the command line I need to write in the terminal? 2. How to get the parameter in the file? What do I need to write in the file? 3. What kind of file is... (1 Reply)
Discussion started by: vess
1 Replies

7. Shell Programming and Scripting

How to pass two word parameter

Hi, How to pass parameter to run folloing script? #parameters are div, dept, style U run_convert_pdm.ksh Mens 44 7542 U run_convert_pdm.ksh "Mens Knit" 44 7541 The first command works fine but the second needs to have two words together , it does not work even if I have used double... (15 Replies)
Discussion started by: sandy162
15 Replies

8. Shell Programming and Scripting

pass parameter to SED

My script(ksh) works fine for --------------------------------------------------- sed -n '28,31p' ${l_name} >> ${LOG_DIR}/Email.txt --------------------------------------------------- But I wand to pass parrmeter to this syntax I did the following things ... (14 Replies)
Discussion started by: deep_kol
14 Replies

9. Shell Programming and Scripting

Pass parameter

Hi, I have following for loop , please let me know how to get ${TXP_EXT_TABLE_${i}_SQL} parameter with 1DAY and 7DAY values. for i in 1DAY 7DAY do ${NZSQL_DIR}/nzsql -h ${HOST} -time -v ON_ERROR_STOP=1 -f ${SQL_DIR}/${TXP_EXT_TABLE_${i}_SQL} > ${TMP_LOG_FILE} 2>&1 done ... (4 Replies)
Discussion started by: sandy162
4 Replies
GPIV_IMG2GPIV(1)					      General Commands Manual						  GPIV_IMG2GPIV(1)

NAME
gpiv_img2gpiv - Converts images into raw data (extension .r) format with the belonging ASCII header file (extension .h) or into the hdf format (extension .hdf). SYNOPSIS
gpiv_img2gpiv [-x | --cross] [-c | --cols ncolumns] [--combine] [-h | --help] [-hdf] [--suf_a EXT] [--suf_b EXT] [--suf_num N] [-i | --inverse] [-n] [-p] [-r | --rows nrows] [-t] [-v | --version] file_base_name DESCRIPTION
gpiv_img2gpiv converts images from a common image format (gif, tif etc) into a raw data image with extension .r. Additionally, it generates an ASCII header file (extension .h). This header contains information concerning image dimensions, color depth, single or double image (for auto or cross-correlation), time and spatial scales, position of pixel# (0, 0) in the experiment and some additional (non-required) parame- ters. gpiv_img2gpiv may also convert to hdf formatted images, with extension .hdf, that might be used by gpiv. This program does not use the parameter resources from libgpiv. The default settings may be overruled by the command line options, as explained below. Options -c | --cols ncolumns The number of columns of the image (default 1280). --combine If the images have been obtained separately, but will have to be used for cross-correlation, they will be combined to a single image file for interrogating with gpiv_rr (or gpiv). See also --suf_a/b and --suf_num. -h | --help On-line help. -hdf Converts to (or from) hdf formatted data (extension .hdf). -i | --inverse Inverse conversion; from raw 8-bit data to image format. --suf_a EXT In combination with --combine: the file_base_name of the first frame to be combined is extended with suffix EXT (default: _a). --suf_b EXT In combination with --combine: the file_base_name of the second frame to be combined is extended with suffix EXT (default: _b). --suf_num N In combination with --combine: If images are numbered instead of with --suf_a and --suf_b. N represents the first of the two num- bered frames which will be combined with frame N + 1. The combined image will be named to file_base_nameN.r. So, only odd or even numbered images will result to be loaded in gpiv_rr (or gpiv) for cross-correlation. -n No execute, only print processes. -p Prints process to stdout. -r | --rows nrows The number of rows in the frame of a SINGLE image (default 1024). An image frame containing a PIV pair of images (to be used for cross-correlation) should have the double amount of rows; from row #0 to row #nrows - 1 contains the first image and from row #nrows to row #2xnrows - 1 contains the second image. -t Image type or format (default bmp). -v | --version Print version information on standard output, then exit successfully. -x | --cross Double image for cross-correlation (default: single image for auto-correlation). SEE ALSO
gpivtools NOTES
The program uses convert. AUTHOR
Gerber Van der Graaf 19 Januari 2005 GPIV_IMG2GPIV(1)
All times are GMT -4. The time now is 08:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy