[HPADM] convert shell script to perl

From: Neeraj Lal (neeraj_lal_at_fastmail.us)
Date: 08/18/04

  • Next message: Neeraj Lal: "[HPADM] (no subject)"
    To: "HPADM LIST" <hpux-admin@dutchworks.nl>
    Date: Tue, 17 Aug 2004 22:42:28 -0400
    
    

    Hi Admin

    Can any one help me in converting the following script into perl as I am
    new to perl

    #! /bin/csh -vx .f
    #Variable Definition

    set LogFile_Name = $1;
    set Err_String_file = "Error_Strings.dat"
    set Backup_Dir = "/home/lalne/logfiles"
    set ext = `date -u | awk '{print $2$3$6$4$5}'`
    #Checking For The Crash Error in Log File

     
    set Return_Code = `tail -100 $LogFile_Name | /usr/bin/egrep -f
    $Err_String_file | wc -l`
    echo $Return_Code

    if ( $Return_Code != 0 ) then
          cp $LogFile_Name $Backup_Dir/$LogFile_Name.$ext
    else
          echo "No Problem"
    endif

    set Server_Name = `echo $LogFile_Name | awk -F. '{print $1}'`
    set Infra_Name = `echo $LogFile_Name | awk -F. '{print $2$3$4}'`

    echo "The Problem is on Server $Server_Name and Infra Name is
    $Infra_Name"

    --
                 ---> Please post QUESTIONS and SUMMARIES only!! <---
            To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
           Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
     
     Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
                http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)
    

  • Next message: Neeraj Lal: "[HPADM] (no subject)"

    Relevant Pages

    • Re: A make question
      ... Your shell is broken. ... Posted the script in my other reply, ... before the perl call. ... echo %SHELL ...
      (comp.os.os2.programmer.misc)
    • Re: how to replace [0]); with [1]); ?
      ... > done < yourfile ... can you give an explaination about your script (including perl, ...
      (comp.unix.shell)
    • Re: FAQ 8.28 How can I call backticks without shell processing?
      ... s> Uri Guttman wrote: ... s> I think you meant to have "echo" not 'echo', although the result, i ... string passed to perl -e. ... they are all using the same internal call to exec which bypasses the ...
      (comp.lang.perl.misc)
    • Re: [9fans] Re: patch/list sorry/proc-mtime
      ... in C by 20h and a version by f2f in perl, ... cpu hogs, but russ's point about ls -lt /proc's uselessness is bang ... cat $i/status && echo $i ...
      (comp.os.plan9)
    • Re: Unwanted Paste behavior
      ... But the app ... Usually if I leave Bat/CMD I go to Perl since it is so much easier than ... or at the command prompt. ... What's odd is that Echo. ...
      (microsoft.public.windows.server.general)