Sponsored Content
Top Forums Shell Programming and Scripting system () output into file in awk Post 302354055 by ergy1983 on Thursday 17th of September 2009 01:31:39 AM
Old 09-17-2009
connecting strings?

I have still the problem with the translation of the following command in awk. In Shell the radiance-command work like that:

Code:
gensurf seitenwand rollerblind1 '-0.95*s' '0.046' '2.85-'$1'*t' 1 1

gensurf seitenwand rollerblind1 '-0.95*s' '0.046' '2.85-'$1'*t' 1 1


But I don't know how to deal with this command in system(). My skript looks like this. the importfile runde.txt is just a tabel with seven columns and numbers in it. I wanted to create a surface with different parameters getting out of the runde.txt file and written in the next course file *_adjust.rad:

Code:
cat runde.txt |awk '{

                                if ($5==2) {
                                                   dataname_v= " $1 "_" $4 "_adjust.rad
                                                   befehl1="gensurf seitenwand rollerblind1 '-0.95*s' '0.046' '2.85-"$7"*t' 1 1 > dataname_v"
                                                   system(befehl)
                                          }
                    }'

cat runde.txt |awk '{ if ($5==2) { dataname_v= " $1 "_" $4 "_adjust.rad befehl1="gensurf seitenwand rollerblind1 '-0.95*s' '0.046' '2.85-"$7"*t' 1 1 > dataname_v" system(befehl) } }'


The problem is the '-sign, because in awk it is used for '{ and always when I am changing it the befehl-variable it is just printing the command with a replaced $7. Or it is telling me that the gensurf-command is used wrong because it is missing the end of the command...

Does anyone has an idea how to solve it? Maybe connecting strings?

Thanks a lot,
Ergy
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can df output be forced to a single line for each file system?

df generates the following output on one of our systems: df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/vx/dsk/rootvol 4131866 3593316 497232 88% / swap 19963152 144 19963008 1% /var/run swap 19985184 ... (6 Replies)
Discussion started by: shew01
6 Replies

2. Shell Programming and Scripting

AWK Output to file.

I have this awk instructions: #Interface with description awk '/hostname/{a=$0} /interface/{b=$0} /address/{print a b $0}' informe-router.txt awk '/interface/{b=$0} /address/{c=$0} /description/{print b c $0}' informe-router.txt awk '/router/,/network/{print $0}' informe-router.txt and I... (2 Replies)
Discussion started by: bobbasystem
2 Replies

3. Shell Programming and Scripting

Parse file using awk and work in awk output

hi guys, i want to parse a file using public function, the file contain raw data in the below format i want to get the output like this to load it to Oracle DB MARWA1,BSS:26,1,3,0,0,0,0,0.00,22,22,22.00 MARWA2,BSS:26,1,3,0,0,0,0,0.00,22,22,22.00 this the file raw format: Number of... (6 Replies)
Discussion started by: dagigg
6 Replies

4. Shell Programming and Scripting

awk - Pre-populating an array from system command output

So, here's a scenario that requires the same logic as what I'm working on: Suppose that you have a directory containing files named after users. For awk's purposes, the filename is a single field-- something parse-friendly, like john_smith. Now, let's say that I'd like to populate an array in... (2 Replies)
Discussion started by: treesloth
2 Replies

5. Shell Programming and Scripting

Capturing awk's system(cmd) output

Hi everybody, I am working on a bigger awk script in which one part is comparing the size of two files. I want to evaluate which file is bigger and then just save the bigger one. I got it all working except for the part where I want to figure out which file is bigger; the one awk is currently... (2 Replies)
Discussion started by: iMeal
2 Replies

6. Shell Programming and Scripting

AWK Script to convert input file(s) to output file

Hi All, I am hoping someone can help me with some scripting I need to complete using AWK. I'm trying to process multiple fixed files to generate one concatenated fixed file in a standard format. The Input file is:- aaaa bbbbb ccccc 1 xxxx aaa bbb aaaa bbbbb ccccc 2 abcd aaa CCC... (9 Replies)
Discussion started by: jason_v_brown
9 Replies

7. Shell Programming and Scripting

Awk script to run a sql and print the output to an output file

Hi All, I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file. Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
Discussion started by: adept
4 Replies

8. Shell Programming and Scripting

awk question : system output to awk variable.

Hi Experts, I am trying to get system output to capture inside awk , but not working: Please advise if this is possible : I am trying something like this but not working, the output is coming wrong: echo "" | awk '{d=system ("date") ; print "Current date is:" , d }' Thanks, (5 Replies)
Discussion started by: rveri
5 Replies

9. UNIX for Dummies Questions & Answers

awk - Rename output file, after processing, same as input file

I have one input file ABC.txt and one output DEF.txt. After the ABC is processed and created output, I want to rename ABC.txt to ABC.orig and DEF to ABC.txt. Currently when I am doing this, it does not process the input file as it cannot read and write to the same file. How can I achieve this? ... (12 Replies)
Discussion started by: High-T
12 Replies

10. Shell Programming and Scripting

awk to reformat output if input file is empty, but not if file has data in it

The below awk improved bu @MadeInGermany, works great as long as the input file has data in it in the below format: input chrX 25031028 25031925 chrX:25031028-25031925 ARX 631 18 chrX 25031028 25031925 chrX:25031028-25031925 ARX 632 14... (3 Replies)
Discussion started by: cmccabe
3 Replies
GENSURF(1)						      General Commands Manual							GENSURF(1)

NAME
gensurf - generate a RADIANCE or Wavefront description of a curved surface SYNOPSIS
gensurf mat name 'x(s,t)' 'y(s,t)' 'z(s,t)' m n [ -e expr ][ -f file ][ -s ][ -o ] gensurf mat name 'x(s,t)' 'y(s,t)' dfile m n [ -e expr ][ -f file ][ -s ][ -o ] gensurf mat name dfile dfile dfile m n [ -s ][ -o ] DESCRIPTION
Gensurf produces either a RADIANCE scene description or a Wavefront .OBJ file of a functional surface defined by the parametric equations x(s,t), y(s,t), and z(s,t). The surface normal is defined by the right hand rule as applied to (s,t). S will vary from 0 to 1 in steps of 1/m, and t will vary from 0 to 1 in steps of 1/n. The surface will be composed of 2*m*n or fewer triangles and quadrilaterals. The expressions are of the same type used in RADIANCE function files. Auxiliary expressions and/or files may be specified in any number of -e and -f options. The -s option adds smoothing (surface normal interpolation) to the surface. The -o option produces a Wavefront .OBJ file rather than a RADIANCE scene description. This is most useful as input to the obj2mesh(1) program for producing a compiled mesh. A single "usemtl" statement will appear at the beginning of the .OBJ output, echoing the modifier given on the command line. Rough holes may be cut in the mesh by defining a valid(s,t) function. Where this function is positive, polygon vertices will be produced. Where it is negative, no geometry will be output. Surface normal interpolation will ignore any invalid vertices. The second invocation form reads z data values from the file dfile. This file must give either m*n or (m+1)*(n+1) floating point z values. If m*n values are given, then the values correspond to the centroid of each quadrilateral region. If (m+1)*(n+1) values are given, then the values correspond to the vertices of each quadrilateral region. The ordering of the data in the file is such that the s values are changing faster than the t values. If a minus ('-') is given for dfile, then the values are read from the standard input. The third invocation form is used to read coordinate triplets from a file or the standard input. The three dfile arguments must all be the same, and the corresponding file must contain three floating point values for each point location. The ordering and other details are the same as those described for z value files above. EXAMPLE
To generate a tesselated sphere: gensurf crystal ball 'sin(PI*s)*cos(2*PI*t)' 'cos(PI*s)' 'sin(PI*s)*sin(2*PI*t)' 7 10 To generate a 10x20 smoothed height field from 12 recorded vertex z values: gensurf dirt ground '10*s' '20*t' height.dat 2 3 -s AUTHOR
Greg Ward BUGS
The smoothing operation requires that functions be defined beyond the [0,1] boundaries of s and t. SEE ALSO
genrbox(1), genrev(1), genworm(1), icalc(1), obj2mesh(1), obj2rad(1), rpict(1), rvu(1), xform(1) RADIANCE
11/15/93 GENSURF(1)
All times are GMT -4. The time now is 08:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy