User Profile

Collapse

Profile Sidebar

Collapse
briggs
briggs
Last Activity: Oct 13 '11, 06:34 PM
Joined: Dec 12 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • briggs
    replied to Redirecting error output to a File
    in Perl
    Code:
    system("dir test.pl >>output.txt");
    system("dir t.pl >>output.txt 2>>output.txt");
    Iam running a system command and need to pass both error and success to same log file. Here system command is in a loop with different commands,. I tried as above but still not working.
    See more | Go to post

    Leave a comment:


  • briggs
    started a topic Redirecting error output to a File
    in Perl

    Redirecting error output to a File

    hi,
    I have a script as below

    test.pl
    system("ls test.pl>output" ), this will write the result to a file output.However if the command fails it throws the error on the screen. How can we redirect the error to a file. I need to redirect both success & failure log in a file

    [Linux ~]$ perl test.pl
    ls: est.pl: No such file or directory
    [Linux~]$

    Any help or pointers...
    See more | Go to post

  • briggs
    started a topic How to delete a line with pattern matching
    in Perl

    How to delete a line with pattern matching

    Hi All,
    I have a file which the following data

    This is a sample
    tool error
    end of file

    I need to delete the line before tool error. I can read the file line by line and match for the key word " tool error", but not sure how to delete the line before the matched line.
    Any pointers to solve this?, thnaks in advance
    See more | Go to post

  • briggs
    started a topic Creating directory/subdirectory
    in Perl

    Creating directory/subdirectory

    I have a file with below contents. the file is dynamically created with these values.It has two parts separated by _. Basically I need to create a main directory(a,b,c ,d) first part and create the sub subdirectory(se cond part after _) into the respective directory. can you please give few tips to do the same.



    a_1234
    a_1234
    b_12
    a_1234
    c_12
    c_12345
    d_12
    See more | Go to post

  • briggs
    started a topic traverse directory and count the number of files
    in Perl

    traverse directory and count the number of files

    Hi All,

    I need to take the count of txt and bak files present in all the directory.for eg if we assume there are two directoies say(test1, test2), I need to collect the count(of txt and bak files) and print it out..

    I tried the below code, but could not achieve what I need.Can someone help me on the same.

    Prg:
    Code:
    ($dir, $extension) = @ARGV;
       $dir = "." unless $dir;
       $lextension
    ...
    See more | Go to post
    Last edited by numberwhun; Dec 15 '09, 06:41 PM. Reason: Please use code tags!
No activity results to display
Show More
Working...