in reply to perl one liner to search for a string, then search for a different string and append a new line

Great! 99.9% there. :)

Current code is:

perl -0777 -elnp 's|(<Directory "/usr/local/awstats.+?</Directory>)|$1+\nCustomLog /usr/local/awstats/logs/access_log comdinedio|s' httpd.conf

It does everything I want, except there is a line-feed followed by another line-feed and a question mark after 'combinedio.' That is:

CustomLog ... combinedio ?

Any ideas how to get rid of at least the question mark?

  • Comment on Re: perl one liner to search for a string, then search for a different string and append a new line
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: perl one liner to search for a string, then search for a different string and append a new line
by BradV (Sexton) on Dec 20, 2012 at 14:32 UTC
    I found the reason for the question mark. I had a typo and was using 'perl -077' instead of 'perl -0777.' All is good.

    Thanks so much for your help! :)