for file in /foo/*
do
if [ -f "$file" ]
then
dd if="$file" of="$file.truncated" bs=31 skip=1 && mv "$file.truncated" "$file"
fi
done
or the faster, thanks to Gilles' suggestion:
for file in /foo/*
do
if [ -f $file ]
then
tail +32c $file > $file.truncated && mv $file.truncated $file
fi
done
Note: Posix tail specify "-c +32" instead of "+32c" but Solaris default tail doesn't like it:
$ /usr/bin/tail -c +32 /tmp/foo > /tmp/foo1
tail: cannot open input
/usr/xpg4/bin/tail is fine with both syntaxes.
If you want to keep the original file permissions, replace
... && mv "$file.truncated" "$file"
by
... && cat "$file.truncated" "$file" && rm "$file.truncated"