User Profile

Collapse

Profile Sidebar

Collapse
pinpe
pinpe
Last Activity: Mar 25 '08, 07:33 PM
Joined: Aug 2 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Hi,

    My apology of giving incomplete info. These were the commands I tried. Actually I want to search from every line of my standard output file the word "DOG" and if not found replaced the entire line with the word "Not Found!". I was confused if I will use a conditional statements or simply using search & replace method. And I end up with the solution below:

    Code:
    #! c:\perl\bin\perl
    ...
    See more | Go to post

    Leave a comment:


  • pinpe
    started a topic Replacing a search/not found pattern with a word
    in Perl

    Replacing a search/not found pattern with a word

    Hi,

    I want to search a pattern from each line of my print output with a word "DOG". And those lines without the word "DOG" I will replace the entire line with the word "Not Found". How can I do it? Pls advice. Tnx in advance.

    Input:
    Code:
    My DOG name 
    *** CAT is in the kitchen
    Name DOG
    *** CAT is in the kitchen
    My DOG name
    My DOG name
    ...
    See more | Go to post

  • pinpe
    replied to Inserting a character to a line
    in Perl
    Hi,

    I found my answer. This works on me:

    Code:
    $x =~ s/\A(....)/$1./;
    Tnx anyway. =)
    See more | Go to post

    Leave a comment:


  • pinpe
    started a topic Inserting a character to a line
    in Perl

    Inserting a character to a line

    Hi,

    How do I insert character (e.g. , or .) at certain positions in a line? For example I want to insert a period ( . ) after the first 4 characters of every each line in the file. I cannot do it in sed command. I'm playing with my script using perl command but to no avail. Please advice. Thanks in advance.

    See below:

    Input:
    Code:
    12345
    67890
    23456
    78901
    34567
    ...
    See more | Go to post

  • pinpe
    replied to extract a log file to filter previous dates
    in Perl
    Hi,

    Someone solved my problem on perlmonks.

    I just want to share it with you guys. Below is the right syntax for my code.

    Code:
    use Net::Telnet;
    use IPadd;
    
    $ipadd=IPadd->new();
    $ipadd->ipadd1();
    
    @Date1=$telnet->cmd("date '+%Y%m%d'");
    chomp($Date1[0]);
    @Date2=$telnet->cmd("date '+%Y-%m-%d'");
    chomp($Date2[0]);
    ...
    See more | Go to post

    Leave a comment:


  • pinpe
    replied to extract a log file to filter previous dates
    in Perl
    Hi KevinADC,

    Are you the same person from perlguru.com? Anyway I'm still looking around for someone who can help me most.

    Br, Pete...
    See more | Go to post

    Leave a comment:


  • pinpe
    started a topic extract a log file to filter previous dates
    in Perl

    extract a log file to filter previous dates

    Hi,

    I have problem of filtering a log file from my perl script.

    This is the file content of the file pinpe.csv:

    2009-06-16
    2009-01-29
    2009-06-02
    2008-03-05
    2007-08-05


    Here is my perl code.
    Code:
    use Net::Telnet;
    
    @DATE=$telnet->cmd("date '+%Y-%m-%d'");
    chomp($DATE[0]);
    
    @Discon=$telnet->cmd("cat
    ...
    See more | Go to post
No activity results to display
Show More
Working...