replaced a while loop by an xargs invocation