Find the answer to your Linux question:
Results 1 to 3 of 3
Hi.I am not so good in perl scripting and i need your help do a script wich must do this : 1. a have some log files like this one ...
  1. #1
    Just Joined!
    Join Date
    Oct 2007
    Posts
    10

    modify the info from a file

    Hi.I am not so good in perl scripting and i need your help do a script wich must do this :
    1. a have some log files like this one for example : access_log.2008_22_02.gz
    2. in every day log file i have some lines like this :
    ::1 - - [20/Feb/2008:08:13:14 +0100] "GET /" 400 456
    3. my script must identify that type of lines (the only modifications are the date and time, but this lines all begin with ::1 - -[) and detele them or change them with ::127.0.0.1

    Thank you very much for you help.

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Of course, we can't drop whatever we're doing and do this for you, but we can take time out to answer specific Perl scripting questions. Nor, of course, can we teach you Perl from the ground up. But you can do that yourself.

    Go here and work your way through the tutorials.

    Then have a go at the script.

    If you have questions about something, and you can't find the answer by experimentation, come back! We're eager to help!
    --
    Bill

    Old age and treachery will overcome youth and skill.

  3. #3
    Just Joined!
    Join Date
    Oct 2007
    Posts
    10
    so i made the script to erase that line but i don't have any idea how to make it work in cron and how make it change only the logs by date.

    log name = access_log_date

    perl -pi.bak -e "s/^::1.*//g" /path to log

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...