#!/bin/sh
while read x1 x2 x3 x4 x5 x6 x7 x8 nc
do
eval "$(awk -v string="$nc" 'BEGIN {num=split(string,a,"/")} {len=length(string)} {lenx=length(a[num])} {printf "cdir=%s\n", substr(string,1,len-lenx-1)} END {printf "fnm=%s\n", a[num]}' )"
echo 'nc='$nc' cdir='$cdir' fnm='$fnm
done < /ptmp/wx52bh/fileMir.loc
Since the text in file fileMir.loc is more than one line, I expect to have more than one output.
However, the program stops after one output.
Any solutions or problems?
Thanks
while read x1 x2 x3 x4 x5 x6 x7 x8 nc
do
eval "$(awk -v string="$nc" 'BEGIN {num=split(string,a,"/")} {len=length(string)} {lenx=length(a[num])} {printf "cdir=%s\n", substr(string,1,len-lenx-1)} END {printf "fnm=%s\n", a[num]}' )"
echo 'nc='$nc' cdir='$cdir' fnm='$fnm
done < /ptmp/wx52bh/fileMir.loc
Since the text in file fileMir.loc is more than one line, I expect to have more than one output.
However, the program stops after one output.
Any solutions or problems?
Thanks