">" used in system() is not printing into file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ">" used in system() is not printing into file
# 1  
Old 09-17-2009
">" used in system() is not printing into file

I have a problem with the following skript in awk.

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)
                                          }
                    }'

It is supposed to create in Radiance a surface with different parameters and then print it into the next course $1 "_" $4 "_adjust.rad-file automaticly. (It is getting $1, $4 and $7 from runde.txt, that is just a table-file with numbers).

The problem is that on one side it is performing the gensurf-command, but still it is just printing out the result on screen and it is also creating the files automatically with the right name, but they are empty.

Does anyone has an idea how to solve it? Maybe connecting strings? I have no idea.

Thanks a lot,
Sandra

Last edited by ergy1983; 09-20-2009 at 01:23 PM..
# 2  
Old 09-18-2009
Quote:
Originally Posted by ergy1983
...
Does anyone has an idea how to solve it? Maybe connecting strings?
...
A couple of trivial things to take care of -

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

tyler_durden
# 3  
Old 09-18-2009
but this isn't working as well.

I tried a lot of things. Your version is just outputting the following error:

Z`SYS(s,t)=2.85-*t;
> ^ unexpected character

1.
Code:
befehl1="gensurf seitenwand rollerblind1 '-0.95*s' '0.046' '2.85-$7*t' 1 1 > dataname_v"

Error:
Z`SYS(s,t)=2.85-*t;
> ^ unexpected character

2.
Code:
befehl1="gensurf seitenwand rollerblind1 '-0.95*s' '0.046' '2.85-$7*t' 1 1" ">" dataname_v

Error:
Usage: c:\Daysim\bin_windows\gensurf.exe material name x(s,t) y(s,t) z(s,t) m n [-s][-e expr][-f file]

3.
Code:
befehl1="gensurf seitenwand rollerblind1 '-0.95*s' '0.046' '2.85-'" $7 "'*t' 1 1 >" dataname_v

Is just printing "# c:\Daysim\bin_windows\gensurf.exe seitenwand rollerblind1 -0.95*s 0.046 2.85-0*t 1 1" into the files


But none of this is performing the command and printing the result into the files.

Last edited by ergy1983; 09-19-2009 at 03:51 PM..
# 4  
Old 09-19-2009
Please, is there anyone who has an idea, how to solve this. Mabe I am just blind for it...
# 5  
Old 09-19-2009
Try to escape the meta characters:

Code:
befehl="gensurf seitenwand rollerblind1 '\''-0.95\\*s'\'' '\''0.046'\'' '\''2.85-\\$7\\*t'\'' 1 1 \\> "dataname_v

# 6  
Old 09-20-2009
Thanks a lot for your answer Franklin52. That is exactly what I was searching for. Unfortunately it is still not working. Is it maybe possible to explain how '/' and // ar working? I cannot find anythin in my books or internet for escaping metacharacters in shell. I just found something about execve(), but this is not defined on my system.

Secondly I tried already something with &, / and +, but I didn't get anywhere. I know that this is very special. I just want to automate my evaluation and am actually dying at this point.

Again thanks for your answer,
Sandra

Last edited by ergy1983; 09-20-2009 at 01:21 PM..
# 7  
Old 09-21-2009
Note that a backslash \ is used to escape the characters, not a slash /.

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

What does "force devmap reload" as in "multipath -r" means for my system and stability of my system?

Cannot present unpresented disks back again. On a test server tried this as a solution "multipath -r" and it worked. Too worried to try it in production before I know all the information. Any info would be appreciated! Also some links to the documentation on this specific issue could help a... (1 Reply)
Discussion started by: jsteppe
1 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. Shell Programming and Scripting

awk "date" and "system" command

Hello experts! I need your help please I have a file.txt of which I want to extract 3rd and 4th columns with date with the form e.g.: 2016-11-25 03:14:50and pass them to "date" command, but also append the 9th column in a file as well. So I want to execute date -d '2016-11-25 03:14:50' ... (2 Replies)
Discussion started by: phaethon
2 Replies

4. Red Hat

Related to "NAS" some file system (mounted volumes) were not writable

Dear friends, I have been facing an issue with one of my red hat unix machine, suddenly lost to switch sudo users. My all colleagues lost to switch to access sudo users. Then, we have realized its related to NAS issue which does not allowing to write the file. because of this we got so many... (1 Reply)
Discussion started by: Chand
1 Replies

5. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

6. Shell Programming and Scripting

Cat Command on File not printing "Blank" Lines?

Hello All, I have a bash script and in it at some point I call an Expect Script that does some stuff and saves its output in a ".txt" file. Example "/path/to/my/file/Expect_Output.txt" file: notice the 2nd line is empty in the file... Data for Host-1 (192.168.1.110) Checking the... (2 Replies)
Discussion started by: mrm5102
2 Replies

7. UNIX for Dummies Questions & Answers

How to Export Glance "Global System Calls" data to a file

Hello... I'm trying to setup a cronjob to record system data using glance at certain times of the day. My question is, how would one export the "Global System Calls" information to a file? Below is the command I have been using and it works to export CPU information. glance -f ... (0 Replies)
Discussion started by: fumus
0 Replies

8. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

9. Shell Programming and Scripting

To start printing a file at line " n" .

To start printing a file at line " n" . let n = 10 and FileName = f1 (3 Replies)
Discussion started by: shashwat2691
3 Replies

10. Programming

Why ""No mountable file system"

I tried to install OpenMotif under Mac OS in the computing lab today, but I got "No mountable file system". Is it because I don't have the administrator's privilege? (0 Replies)
Discussion started by: endeavour1985
0 Replies
Login or Register to Ask a Question