john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Perl file regex

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/perl
use Switch;


my $data_file = '/var/lib/tomcat6/webapps/storagegateway/WEB-INF/app.properties';
open DATA, "$data_file" or die "can't open $data_file $!";
my @array_of_data = <DATA>;
close (DATA);

my $target = 'starttext=';
foreach my $line ( @array_of_data )
{
  $found = $line =~ m/^($target)/;
  if( $found )
  {
    my @result = split( $target , $line  );
    my $finalresult = join( "" , @result );
    print "$finalresult";
  }
}

  • « fileBrowser
  • Vmware vim cmd snapshots remote ssh with expect »

Published

Jan 24, 2012

Category

bat-vbs-perl

~61 words

Tags

  • bat-vbs-perl 51
  • file 92
  • perl 14
  • regex 2