insert a character in line using sed/awk
Hello !
I have a string as below LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined Want the above string to be modified as LogFormat "%h %l %u %D %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined inserting %D after %u in the string Please suggest. |
Code:
sed 's/%u/& %D/' |
sed -i '/^LogFormat/s/%u/& %D/' file
You can use perl in-line editing too in a similar way. |
thanks it worked.
|
All times are GMT -5. The time now is 10:06 AM. |