Sponsored Content
Operating Systems AIX really stuck- need to get a variable within a variable- AWK Post 302211081 by vgersh99 on Wednesday 2nd of July 2008 03:19:04 PM
Old 07-02-2008
My examples is. well...... just an example -given a sample file you provided - how to convert it to what (I think) is needed.

Not having a complete data set nor a complete awk script - it's hard to say how to adjust a sample code above to your particular circumstance. You probably know all the details of what your awk script is doing the best - so you'll have massage the given code sample.

But...
Code:
BEGIN {
   FS=OFS="="
}
# the rest of the script


function evalVars(   i)
{
   val[$1]=$2
   i=$2
   while (1) {
      if (i in val)
        i=val[i]
      else
        break
    }
    $2=i
}

# some more of the script
#......

# some action here
{ 
   # resolve the vals
   evalVars()
  # do more stuff with the "resolved" data
  print
}

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert a line including Variable & Carriage Return / sed command as Variable

I want to instert Category:XXXXX into the 2. line something like this should work, but I have somewhere the wrong sytanx. something with the linebreak goes wrong: sed "2i\\${n}Category:$cat\n" Sample: Titel Blahh Blahh abllk sdhsd sjdhf Blahh Blah Blahh Blahh Should look like... (2 Replies)
Discussion started by: lowmaster
2 Replies

2. Shell Programming and Scripting

How to define a variable with variable definition is stored in a variable?

Hi all, I have a variable say var1 (output from somewhere, which I can't change)which store something like this: echo $var1 name=fred age=25 address="123 abc" password=pass1234 how can I make the variable $name, $age, $address and $password contain the info? I mean do this in a... (1 Reply)
Discussion started by: freddy1228
1 Replies

3. Shell Programming and Scripting

assign awk's variable to shell script's variable?

Dear All, we have a command output which looks like : Total 200 queues in 30000 Kbytes and we're going to get "200" and "30000" for further process. currently, i'm using : numA=echo $OUTPUT | awk '{print $2}' numB=echo $OUTPUT | awk '{print $5}' my question is : can I use just one... (4 Replies)
Discussion started by: tiger2000
4 Replies

4. Shell Programming and Scripting

using awk for setting variable but change the output of this variable within awk

Hi all, Hope someone can help me out here. I have this BASH script (see below) My problem lies with the variable path. The output of the command find will give me several fields. The 9th field is the path. I want to captured that and the I want to filter this to a specific level. The... (6 Replies)
Discussion started by: Cowardly
6 Replies

5. Red Hat

How to pass value of pwd as variable in SED to replace variable in a script file

Hi all, Hereby wish to have your advise for below: Main concept is I intend to get current directory of my script file. This script file will be copied to /etc/init.d. A string in this copy will be replaced with current directory value. Below is original script file: ... (6 Replies)
Discussion started by: cielle
6 Replies

6. Shell Programming and Scripting

[Solved] How to increment and add variable length numbers to a variable in a loop?

Hi All, I have a file which has hundred of records with fixed number of fields. In each record there is set of 8 characters which represent the duration of that activity. I want to sum up the duration present in all the records for a report. The problem is the duration changes per record so I... (5 Replies)
Discussion started by: danish0909
5 Replies

7. Shell Programming and Scripting

awk print variable then fields in variable

i have this variable: varT="1--2--3--5" i want to use awk to print field 3 from this variable. i dont want to do the "echo $varT". but here's my awk code: awk -v valA="$varT" "BEGIN {print valA}" this prints the entire line. i feel like i'm so close to getting what i want. i... (4 Replies)
Discussion started by: SkySmart
4 Replies

8. Shell Programming and Scripting

awk variable search and line count between variable-search pattern

Input: |Running the Rsync|Sun Oct 16 22:48:01 BST 2016 |End of the Rsync|Sun Oct 16 22:49:54 BST 2016 |Running the Rsync|Sun Oct 16 22:54:01 BST 2016 |End of the Rsync|Sun Oct 16 22:55:45 BST 2016 |Running the Rsync|Sun Oct 16 23:00:02 BST 2016 |End of the Rsync|Sun Oct 16 23:01:44 BST 2016... (4 Replies)
Discussion started by: busyboy
4 Replies

9. UNIX for Beginners Questions & Answers

How can I assign awk's variable to shell script's variable?

I have the following script, and I want to assign the output ($10 and $5) from awk to N and L: grdinfo data.grd | awk '{print $10,$5}'| read N L output from gridinfo data.grd is: data.grd 50 100 41 82 -2796 6944 0.016 0.016 3001 2461. where N and L is suppose to be 3001 and 100. I use... (8 Replies)
Discussion started by: geomarine
8 Replies

10. UNIX for Beginners Questions & Answers

Grepping for one variable while using awk to parse an associated variable

Im trying to search for a single variable in the first field and from that output use awk to extract out the lines that contain a value less than a value stored in another variable. Both the variables are associated with each other. Any guidance is appreciated. File that contains the... (6 Replies)
Discussion started by: ncwxpanther
6 Replies
pfshdrcalibrate(1)					      General Commands Manual						pfshdrcalibrate(1)

NAME
pfshdrcalibrate - Create an HDR image or calibrate a response curve from a set of differently exposed images supplied in PFS stream. SYNOPSIS
pfshdrcalibrate [--response <type>] [--calibration <type>] [--gauss <val>] [--response-file <filename.m>] [--save-response <filename.m>] [--multiplier <val>] [--bpp <val>] [--luminance] [--samples <val>] [--help] [--verbose] DESCRIPTION
Create an HDR image or calibrate a response curve from a set of differently exposed images supplied in PFS stream. When used with 8bit images, luminance in the output HDR image corresponds to real world values in [cd/m^2] provided that hdrgen script con- tained correct information on exposure time, aperture and iso speed. Note that sometimes ISO speed indicated by camera does not correspond to standard (ISO-100 is in fact ISO-125). The accuracy of absolute calibration has not been thoroughly tested with different camera models, however one can expect the relative mea- surement error below 8%. Use pfsabsolute in case of systematic error. OPTIONS
--response <type>, -r <type> Allows to choose from predefined response curves. This can be used either to apply this response or use it as an initialization for automatic self-calibration. Predefined response curves are: "linear", "gamma", "log". Default is "linear". --calibration <type>, -c <type> Type of automatic self-calibration method used for recovery of the response curve. Accepted types include: "none", "robertson", "mitsunaga". Default is "robertson". In case "none" is chosen, a predefined response will be used, without self-calibration. More infomation on the algorithms can be found in: M.A. Robertson, S. Borman and R.L. Stevenson Dynamic range improvement through multiple exposures In: Proc. of International Conference on Image Processing 1999 (ICIP 99), pp 159-163 vol.3 and T. Mitsunaga and S. K. Nayar Radiometric Self Calibration In: Proc on IEEE Conf. on Computer Vision and Pattern Recognition (CVPR'99). Volume 1, p. 1374 --gauss <val>, -g <val> Sigma value for the Gaussian used as a weighting function. Applies to Robertson02 algorithm. Default value: 16.0f --response-file <filename.m>, -f <filename.m> Use response curve saved in the matlab format file. Turns off automatic self-calibration. Uses Robertson02 model to apply the response curve. --save-response <filename.m>, -s <filename.m> Saves the response curve calculated during automatic self-calibration stage in a matlab format file. Can be later reused for set of images captured with given camera. Also works fine for plotting with gnuplot. --multiplier <val>, -m <val> Input multiplier value. Can be used to manipulate the range of source exposures. Default value is 256 since LDR images are by default scaled to 0..1. --bpp <val>, -b <val> Number of bits per pixel in input data from the camera. Default value is 8. --samples <val>, -p <val> Number of sample pixels used in inverse response computations in Mitsunaga algorithm. Default is 50000. --fix-saturated, -x Use this option if you see black pixels in overexposed / saturated areas. The black pixels are visible if all exposures contain pixel values that are outside reliable range (are under- or over-exposed). This flag gives non-zero weight for the brightest and the darkest pixels, thus avoiding zero-weighted pixels. Note that the calculated luminance values for these pixels are not reliable. --luminance, -Y Recovery of response curve will be performed for luminance channel only. --verbose Print additional information during program execution. --help Print list of commandline options. EXAMPLES
pfsinhdrgen sample.hdrgen | pfshdrcalibrate -v -s response.m Recover the response curve from set of exposures defined in sample.hdrgen and save it to response.m file. To view the response curve, run gnuplot and write 'plot "response.m"'. pfsinhdrgen sample.hdrgen | pfshdrcalibrate -x -f response.m | pfsview Create an HDR image from exposures defined in sample.hdrgen using the response curve "response.m" and view it. Fix the problem with black values given to overexposed pixels. pfsinhdrgen sample.hdrgen | pfshdrcalibrate | pfsview Create an HDR image from exposures defined in sample.hdrgen using the default self-calibration method and view it. pfsinhdrgen sample_dcraw.hdrgen | pfshdrcalibrate -b 16 -r linear -c none | pfsview Given that the script sample_dcraw.hdrgen refers to camera RAW files (see pfsindcraw), this example will generate an HDR image assuming a linear response. pfsinhdrgen sample.hdrgen | pfshdrcalibrate | pfsview Create an HDR image from exposures defined in sample.hdrgen using the default self-calibration method and view it. pfsinhdrgen sample.hdrgen | pfshdrcalibrate -c mitsunaga -samples 100000 | pfsglview Create an HDR image from exposures defined in sample.hdrgen using the mitsunaga self-calibration method with 100000 samples and view it in pfsglview. SEE ALSO
pfsinhdrgen(1) jpeg2hdrgen(1) pfsview(1) pfsindcraw(1) pfsabsolute(1) pfsglview(1) BUGS
Please report bugs and comments on implementation to Grzegorz Krawczyk <gkrawczyk@users.sourceforge.net>. pfshdrcalibrate(1)
All times are GMT -4. The time now is 12:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy