unix - suppress the output to screen in shell script -
hi have written small script:
#!/usr/bin/ksh in *.dat awk 'begin{ofs=fs=","}$3~/^353/{$3="353861958962"}{print}' $i >> $i_changed awk '$3~/^353/' $i_changed >> $i_353 rm -rf $i_changed done exit
i tested , wrking fine. giving output screen dont need output screen. need final file made $i_353
how possible?
wrap body of script in braces , redirect /dev/null:
#!/usr/bin/ksh { in *.dat 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
this sends errors bit-bucket too. may not such idea; if don't want that, remove 2>&1
redirection.
also: beware - need use ${i}_changed
, ${i}_353
. why output not going files...your variables ${i_changed}
, ${i_353}
not initialized, , hence redirections don't name file.
Comments
Post a Comment