I am using sed like this: sed -e 's/ *| */|/g'   ${array_export_files[$loopcount]}>>$TEMPDIR/export_file_${testid}_${loopcount}_$$under a while loop but problems come when the file is empty or contains nothing.I don't want the sed to run if the file exists but is empty;I don't want the sed to run if the file doesn't exist.The complete code snippet is while [ $loopcount -le $loopmax ]do     if [ $loopcount -eq $loopcount ]    then        sed -e 's/ *| */|/g' ${array_export_files[$loopcount]}>>$TEMPDIR/export_file_${testid}_${loopcount}_$$        tr | \t <export_file_${testid}_${loopcount}_$$>${array_export_files[$loopcount]}        cp ${array_export_files[$loopcount]} export_file_${loopcount}_${testid}        echo Testing Starts Here        echo ${array_export_files[$loopcount]} export_file_${loopcount}_${testid}        echo Testing Ends Here    fi  (( loopcount=`expr $loopcount+1`))done    So I can't replace or use AND operator on the above if statement is there anyway to solve that?if I use AND operator then it may skip the below whole code section will nor run I only wanted to skip the sed section conditionally.
How can I skip empty files with sed?
bash;shell script;ksh