Hi

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pushkar2284
    New Member
    • Dec 2006
    • 4

    Hi

    hi i'll be glad if anyone could help me out with my problem.
    i have an input file as :
    ABC999991,02040 6,020406
    BBD999992,02040 6,020406
    FBE999993,02040 6,020406
    ABF999994,02040 6,020406
    999999991,02040 6,020406
    999999992,02040 6,020406
    999999993,02040 6,020406
    999999994,02040 6,020406
    FBE999993,02040 6,020406
    ABF999994,02040 6,020406
    999999995,02040 6,020406

    i require output as:
    ABC999991,02040 6,020406
    BBD999992,02040 6,020406
    FBE999993,02040 6,020406
    ABF999994,02040 6,020406
    FBE999993,02040 6,020406
    ABF999994,02040 6,020406

    i have written following code but it is not working
    #!/usr/bin/perl -w
    #Purpose : Reading from a file(input.txt)

    open READ,"input.txt " || die "file does not exist $!";
    while (<READ>)
    {
    $myfile .=$_;
    }
    print "$myfile";
    $myfile=~s/^\d.*//gi;
    print "************** *************** *******\n";
    print "$myfile";
    open ROUT,">>output1 .txt" || die "problem $!";
    print ROUT $myfile;
    close ROUT;
    close READ;

    can someone help me out .
    thanks and regards
  • pushkar2284
    New Member
    • Dec 2006
    • 4

    #2
    i was trying to do it without using a loop..

    Comment

    • pushkar2284
      New Member
      • Dec 2006
      • 4

      #3
      hey guys i have found a solution for the prolem

      $myfile =~s/\b\s\d.*//g;

      Comment

      Working...