ls -l|grep ^d|awk '{print $8}'
Grep matches the beginning of the line output by 'ls' with 'd', which indicates a directory. " 'awk {print $8}' " then prints the 8th column of the output (so the directory name is available again).
ls -l|grep ^d|awk '{print $8}'
vi "+:%s/+0/+1/g" "+wq" $i