#!/bin/bash for file in `find dir -type f`;do x=`ls -l $file | grep -E "^-.......w." | awk -F" " '{print $1 " " $9}'` if test "$x"!="";then echo $x chmod o-w "$file" ls -l $file | awk -F" " '{print $1 " " $9}' fi done