OFS (Output Field Separator) is ignored when using { print } instead of { print $1,$2,$3... }.
awk '{$1=$1};1' input.txt# The following shows:
# apple
# pineapple
echo "apple\norange\npineapple" | awk '/apple/ { print $0 }'awk -F, '{print $NF}' input.txt