Wrap the body of the script in braces and redirect to / dev / null:
#!/usr/bin/ksh { for i in *.DAT do awk 'BEGIN{OFS=FS=","}$3~/^353/{$3="353861958962"}{print}' $i >> $i_changed awk '$3~/^353/' $i_changed >> $i_353 rm -rf $i_changed done } >/dev/null 2>&1
It also sends errors to the bit bucket. Perhaps this is not such a good idea; if you do not want this, remove the redirection 2>&1 .
Also: beware - you probably need to use ${i}_changed and ${i}_353 . That's why the output does not go to files ... your variables ${i_changed} and ${i_353} not initialized, and therefore redirects do not name the file.
source share