">" 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
# 8  
Old 09-21-2009
thanks a lot for your answer again Franklin52.

I think it is not possible what I want to do because of responding to a variable in system(). Do you know wether there are other possibilities responding a variable ($7) or connecting the strings between $7. Because this one worked already with printing the whole true command into the files:

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

Or do you think it is possible to pipe the result of this into another variable and then using it in a second system()-command?

Thanks a lot. Regards, Sandra
# 9  
Old 09-21-2009
Is $7 a shell or an awk variable?

Regards
# 10  
Old 09-21-2009
it is an awk variable, I think. Actually a good question.

I am piping every number in column 7 of runde.txt to awk to use it for befehl1.
(So because gensurf is supposed to create a surface I'll get in the end for example ten different surfaces created and saved into ten different files if I have ten different numbers a line in column 7 - thats my goal)

Why?

Regards

Last edited by ergy1983; 09-21-2009 at 01:28 PM..
# 11  
Old 09-21-2009
Quote:
Originally Posted by ergy1983
it is an awk variable, I think. Actually a good question. I am piping every number in column 7 of runde.txt to awk to use it for befehl1.

Why?

Regards
Don't escape $7 in that case:

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

# 12  
Old 09-21-2009
thanks. Exactly, I don't want to escape $7.

But dealing with the command like this system() is not able to perform the command. Because it is not able to connect the first part before $7 ("gensurf...") with the second one ("\\*t'\'' 1 1 \\> ").Thats the problem.

And if I dont' just put " before and behind $7 it is telling me that there is an unexpected character (the $-sign). and i even don't think that system would interpretate it anymore as a variable.

That is actually the reason I was asking you for connecting the both strings (before and behind $7)? Or piping it somewhere else and then using it...

Last edited by ergy1983; 09-21-2009 at 01:55 PM..
# 13  
Old 09-21-2009
Do you get the right shell command with this command?

Code:
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

# 14  
Old 09-21-2009
no just empty space...

Last edited by ergy1983; 09-22-2009 at 04:32 AM..
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