Calling UNIX command fron FORTRAN

I want to run the unix command in a fortran code

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

I am trying like this but getting problems

 
  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

 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

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

i = index(s,'/')-1
i = scan(s,'/')-1
s = s(1:i)

If you insist on calling shell, please simplify

awk '{split($1, a, "/"); print a[1]}'

to

awk -F/ '{print $1}'

or

cut -d/ -f1