1

Insert strings/values between text

view story
linux-howto

http://www.unix.com – Hello Guru, I'm trying to insert a value between 2 fields (between last and second last field) But end up the script actually replacing the value in the second last field. What should i put to fix the problem? Input File: Code: apple,mango,grape,lemon Expected output: Code: apple,mango,grape,0,lemon Code: awk -F, 'BEGIN{OFS=","}{$(NF-1)="0";print}' input my output (grape is missing) Code: apple,mango,0,lemon Thanks (HowTos)