Re: [squid-users] changing access log name from shell ...

From: Henrik Nordstrom <hno@dont-contact.us>
Date: 19 May 2003 18:33:47 +0200

mån 2003-05-19 klockan 17.05 skrev Kenn Murrah:

> i should have worded my question better ... yes, of course i can edit
> the file using vi (and occasionally do), but i'm trying to automate a
> procedure (of which changing the current name of the accesslog is a
> part) ... so probably Christoph's suggestion that i use an awk script
> would probably be the best solution ??? i can do that, but didn't know
> if there might be another way ...

It is a text file, and any automated tool which can edit text files will
do the job for you.

I usually use ed for this type of batch editing, or perl for more
advanced jobs.. (the -i option is very nice).

but there is at least as many ways to solve this as there is ways to
formulate the question, probably an magnitude more.

The first thing you need to decide upon is if you want to modify the
file in place, or to work by having a template and then fill in the
needed values to create a real configuration file. This is a fundamental
decision for the design of your system and the tools to use differs a
bit depending on the answer.

awk is a very good tool for the template approach. sed also works fine
here.

ed is a reasonable tool for simple in-place edits, but ed scripts is a
bit awkward to understand sometimes and not that easy to get right the
first time..

perl -i is more advanced in place editor, but also generally requires a
bit more writing to get the script correct.

Once perhaps very nice combo for in-place edit is a2p. Write your basic
edit script in awk, and then convert it to perl with a2p and extend with
more advanced features and in-place edit capability.

Regards
Henrik

-- 
Donations welcome if you consider my Free Squid support helpful.
https://www.paypal.com/xclick/business=hno%40squid-cache.org
Please consult the Squid FAQ and other available documentation before
asking Squid questions, and use the squid-users mailing-list when no
answer can be found. Private support questions is only answered
for a fee or as part of a commercial Squid support contract.
If you need commercial Squid support or cost effective Squid and
firewall appliances please refer to MARA Systems AB, Sweden
http://www.marasystems.com/, info@marasystems.com
Received on Mon May 19 2003 - 10:33:54 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:16:45 MST