IMLC.ME

Bash 如何添加前后缀

添加前缀

echo 'Oops! something went wrong' | sed -e 's/^/ERROR /' 
echo 'Oops! something went wrong' | awk '$0="ERROR "$0'

添加后缀

echo 'Oops! something went wrong' | sed -e 's/$/ ERROR/' 
echo 'Oops! something went wrong' | awk '$0=$0" ERROR"'