regex - process text file in ksh append data -
following doesn't work. need add , , input param @ end of script. please help
#!/bin/ksh data_log="/usr/data/data_log.dbg" err_file="/usr/data/data_log.err" if [ $# -eq 1 ]; inparam=$1 fi processinfo ${inparam} > ${data_log} #append ,inparam each line in log further processing logger in `cat ${data_log}` { echo ${logger} | sed s/$/,${inparam}/ >> ${err_file} } rm -rf ${data_log}
replace for logger in
loop you're reading file this:
cat ${data_log} | while read line echo "${line},${inparam}" >> ${err_file} done
...which think can written (no shell test @ moment) avoid uuoc...
while read line echo "${line},${inparam}" >> ${err_file} done < ${data_log}
Comments
Post a Comment