Calling UNIX command fron FORTRAN


 
Thread Tools Search this Thread
Top Forums Programming Calling UNIX command fron FORTRAN
# 1  
Old 03-11-2013
Calling UNIX command fron FORTRAN

I want to run the unix command in a fortran code

Code:
echo trim(val_fgsize) | awk '{split($1, a, "/"); print a[1]}'

I am trying like this but getting problems

Code:
 
  s='echo ' // trim(val_fgsize) // '| awk '{split($1, a, "/"); print a[1]}'' 
  call system(s)

---------- Post updated at 05:15 PM ---------- Previous update was at 04:58 PM ----------

Done it

Code:
 s='echo ' // trim(val_fgsize) // ' | awk ' // '''{split($1, a, "/"); print a[1]}'''
  call system(s)

---------- Post updated at 06:21 PM ---------- Previous update was at 05:15 PM ----------

I am having a problem putting the output from call system(s) to be stored in a character string
# 2  
Old 03-12-2013
Oh that's cumbersome.
I am not a Fortran expert; call system() might not return stdout at all.
Instead, try to use Fortran's string functions.
Like
Code:
i = index(s,'/')-1
i = scan(s,'/')-1
s = s(1:i)

If you insist on calling shell, please simplify
Code:
awk '{split($1, a, "/"); print a[1]}'

to
Code:
awk -F/ '{print $1}'

or
Code:
cut -d/ -f1

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to sftp fron UNIX to window server using expect?

HI I am using expect to transfer the file from unix system to windows server. however it is not taking the password. same I tried without script also but still it is not accepting the password. when I tried with winscp tool it accepting the password. I am not sure where I am doing wrong ... (4 Replies)
Discussion started by: scriptor
4 Replies

2. Shell Programming and Scripting

Calling another Script from Command Line in UNIX

Hi all, I am having problem in understanding the following line of code .. /home/rmsbatch/autoscript/autorms.ksh dc_load_main.ksh -q belk_dc_load_tran_data.seq What's being done here ? what does "-q" means ? What does ".seq" file means in unix "belk_dc_load_tran_data.seq" Please... (3 Replies)
Discussion started by: LoneRanger
3 Replies

3. UNIX for Dummies Questions & Answers

Calling Macros in UNIX command

Hi .. I have created a sql macro, i want to execute this through ksh in putty.ie) sql.ksh will contain the macro query ,once i call this ksh ,the macro should trigger. I am able to write a macro : for ex: create macro macro_name (sel * from db_tablename) execute macro_name. Could... (1 Reply)
Discussion started by: Kalaiselvi66
1 Replies

4. UNIX for Dummies Questions & Answers

Unix Shell Scripting( Calling from Unix to PLSQL)

Hello Experts, I have the following questions to be discussed here at this esteemed discussion forum. I have two Excel sheets which contain Unix Commands llike creating directory the structure/ftp/Copy/Zip etc to basically create an environment. I need help in understanding some of... (1 Reply)
Discussion started by: faizsaadq
1 Replies

5. Red Hat

controlling tool running on Linux VM fron Windows

I have a virtual machine with RedHat. It has a command-line tool X that takes an input file + some control parameters, performs some processing and generates some input files. I have a Windows XP/Server 2003 box where an app Y is running. What I need to do is to control X from Y. That is, given an... (1 Reply)
Discussion started by: ilyaz
1 Replies

6. Programming

calling UNIX commands C/C++

hi Guys, I am planning to write a program which can be able to execute scripts/commands which needs a user to be root. Note: we are not interested to use sudoers option. .e.g. The requirement can be explaind as: A normal UNIX system user cannot execute above command(veritas cluster... (3 Replies)
Discussion started by: Asteroid
3 Replies

7. UNIX for Dummies Questions & Answers

two files.say a and b.both have long columns.i wanna match the column fron 1st file w

ex: a file has : 122323 123456456 125656879 678989965t635 234323432 b has : this is finance no. this is phone no this is extn ajkdgag idjsidj i want the o/p as: 122323 his is finance no. 123456456 this is phone no 123456456 ... (4 Replies)
Discussion started by: TRUPTI
4 Replies

8. Programming

calling UNIX script from C/C++

Hi all, Is it possible to call a UNIX script from C/C++ program? If yes, can you please tell me how? Thank you in advance Regards (3 Replies)
Discussion started by: omran
3 Replies

9. UNIX for Dummies Questions & Answers

Java program calling a UNIX command

I was wondering if it was possible to call a unix command directly from a Java program during run-time. This command could very very basic e.g. "ps -ef" returned as a string, all I need is a starting place so if anyone has any suggestion or examples I would be very grateful (2 Replies)
Discussion started by: QUartz Ite
2 Replies
Login or Register to Ask a Question