Visit Our UNIX and Linux User Community


">" 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
# 15  
Old 09-21-2009
Strange.. can you post the content of runde.txt between code tags.
# 16  
Old 09-22-2009
of course:

Code:
nr blickr zeit system raum jal_hoehe_vorher jal_winkel_vorher jal_hoehe_nachher jal_winkel_nachher /rol_A_vorher rol_B_vorher rol_C_vorher rol_A_nachher rol_B_nachher rol_C_nachher
201 diagonal afternoon J1 1 L 0 30 0,94 40
201 diagonal afternoon R1 2 L 0 0 0 0,78 0,78 1,04
201 diagonal afternoon J2 1 L 0 0 1,11 42
201 diagonal afternoon R2 2 L 0 0 0 1,7 1,33 1,29
202 diagonal afternoon J2 1 R 0 0 0 42
202 diagonal afternoon R2 2 R 0 0 0 2,91 0 0,78
202 diagonal afternoon J1 1 R 0 36 0 36
202 diagonal afternoon R1 2 R 0 0 0 2,91 0,78 0,78
203 diagonal morning J1 1 L 0 60 0 35
203 diagonal morning R1 2 L 0 0 0 1,62 1,62 2,06
203 diagonal morning R2 2 L 0 0 0 1,67 1,66 2,01
203 diagonal morning J2 1 L 0 60 0 0
204 diagonal morning J2 1 R 0 60 0,33 17
204 diagonal morning R2 2 R 0 0 0 2,11 1,24 1,7
204 diagonal morning R1 2 R 0 0 0 2,11 0,82 1,47
204 diagonal morning J1 1 R 0 60 0 52

# 17  
Old 09-22-2009
Quote:
Originally Posted by ergy1983
no just empty space...
This is what I get, so I don't understand why you didn't get any output:

Code:
$ cat runde.txt
nr blickr zeit system raum jal_hoehe_vorher jal_winkel_vorher jal_hoehe_nachher jal_winkel_nachher /rol_A_vorher rol_B_vorher rol_C_vorher rol_A_nachher rol_B_nachher rol_C_nachher
201 diagonal afternoon J1 1 L 0 30 0,94 40
201 diagonal afternoon R1 2 L 0 0 0 0,78 0,78 1,04
201 diagonal afternoon J2 1 L 0 0 1,11 42
201 diagonal afternoon R2 2 L 0 0 0 1,7 1,33 1,29
202 diagonal afternoon J2 1 R 0 0 0 42
202 diagonal afternoon R2 2 R 0 0 0 2,91 0 0,78
202 diagonal afternoon J1 1 R 0 36 0 36
202 diagonal afternoon R1 2 R 0 0 0 2,91 0,78 0,78
203 diagonal morning J1 1 L 0 60 0 35
203 diagonal morning R1 2 L 0 0 0 1,62 1,62 2,06
203 diagonal morning R2 2 L 0 0 0 1,67 1,66 2,01
203 diagonal morning J2 1 L 0 60 0 0
204 diagonal morning J2 1 R 0 60 0,33 17
204 diagonal morning R2 2 R 0 0 0 2,11 1,24 1,7
204 diagonal morning R1 2 R 0 0 0 2,11 0,82 1,47
204 diagonal morning J1 1 R 0 60 0 52
$
$ awk '{
  if ($5==2) {
    befehl="gensurf seitenwand rollerblind1 '\''-0.95\\*s'\'' '\''0.046'\'' '\''2.85-" $7 "\\*t'\'' 1 1 \\> " $1 "_" $4 "_adjust.rad"
    print befehl
  }
}' runde.txt
gensurf seitenwand rollerblind1 '-0.95\*s' '0.046' '2.85-0\*t' 1 1 \> 201_R1_adjust.rad
gensurf seitenwand rollerblind1 '-0.95\*s' '0.046' '2.85-0\*t' 1 1 \> 201_R2_adjust.rad
gensurf seitenwand rollerblind1 '-0.95\*s' '0.046' '2.85-0\*t' 1 1 \> 202_R2_adjust.rad
gensurf seitenwand rollerblind1 '-0.95\*s' '0.046' '2.85-0\*t' 1 1 \> 202_R1_adjust.rad
gensurf seitenwand rollerblind1 '-0.95\*s' '0.046' '2.85-0\*t' 1 1 \> 203_R1_adjust.rad
gensurf seitenwand rollerblind1 '-0.95\*s' '0.046' '2.85-0\*t' 1 1 \> 203_R2_adjust.rad
gensurf seitenwand rollerblind1 '-0.95\*s' '0.046' '2.85-0\*t' 1 1 \> 204_R2_adjust.rad
gensurf seitenwand rollerblind1 '-0.95\*s' '0.046' '2.85-0\*t' 1 1 \> 204_R1_adjust.rad
$

Play around with the code to get the desired output.

Regards
# 18  
Old 09-28-2009
solution

Hey ho,

found the solution for it. the problem was still that even I was able to print it (thanks Franklin52) system() didn't work. Here is the solution:

Code:
$ cat runde.txt |awk -f test.awk

with test.awk:
Code:
{
s=sprintf("gensurf seitenwand rollerblind1 '-0.95*s' '0.046' '2.85- %1$s*t' 1 1 > %2$s_%3$s_adjust.rad\n", $7, $1, $4)
print "str", s
system(s)
}



Previous Thread | Next Thread
Test Your Knowledge in Computers #61
Difficulty: Easy
A computer on a LAN segment is uniquely identified by its MAC address.
True or False?

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

Featured Tech Videos