$ echo $STR
127.0.0.1 - - [10/Nov/2013:04:14:03 +0000] "GET /XXXX/js/service.js HTTP/1.1" 200 656 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0" "X-Forwarded-For=75.67.17.69, 10.2.0.121" "JSESSIONID=YYYY" 2
$ echo $STR | perl -pe 's/X\-Forwarded\-For=([\d\.]+).*?\"/X-Forwarded-For=$1"/g'
127.0.0.1 - - [10/Nov/2013:04:14:03 +0000] "GET /XXXX/js/service.js HTTP/1.1" 200 656 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0" "X-Forwarded-For=75.67.17.69" "JSESSIONID=YYYY" 2