xargs command problem

Hi
I am trying to use "xargs" command to loop through each file, modify it and overwrite the old file with the modification but with the same file name.

I thought it is easy but I just can't get it to work

I tried the following
I thought {} would give me the current file name, but it doesn't. It just create a file with name '{}'

Any idea?

 
ls ./Client*log | xargs nawk '{
if(match($3,/\^/){
   print substr($3, 2, length($3)-2)
}
}' > ./temp | xargs mv ./temp {}

Thanks in advance for your help

The output of "... > ./temp" is nothing. So you are piping nothing into the second xargs.

You might have better luck with something like this:

for f in ./Client*log; do
    nawk ... $f > temp
    mv -f temp $f
done