Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
- if $running_under_some_shell;
- # this emulates #! processing on NIH machines.
- # (remove #! line above if indigestible)
- eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift;
- # process any FOO=bar switches
- $[ = 1; # set array base to 1
- $, = ' '; # set output field separator
- $\ = "\n"; # set output record separator
- $state = 0;
- $temp1 = "";
- $temp2 = "";
- $musr = qr/\(-,user3,[^,]+\.co\.uk\)\\$/;
- $lusr = qr/\(-,user3,[^,]+\.co\.uk\)$/;
- $strprn="";
- while (<>) {
- chomp; # strip record separator
- if (($state == 0) && ($_ !~ $musr) && ($_ !~ $lusr)) {
- if (length($temp1) != 0) {
- print $temp1;
- }
- $temp0 = $_;
- $state = 1;
- }
- elsif (($state == 1) && ($_ !~ $musr) && ($_ !~ $lusr)) {
- if (length($temp0) != 0) {
- print $temp0;
- }
- $temp1 = $_;
- $state = 0;
- }
- elsif (($state == 0) && ($_ =~ $musr)) {
- $state = 2;
- }
- elsif (($state == 2) && ($_ =~ $musr)) {
- $state = 3;
- }
- elsif (($state == 3) && ($_ !~ $musr) && ($_ !~ $lusr)) {
- print $temp1;
- print $_;
- $temp1 = "";
- $temp0 = "";
- $state = 1;
- }
- elsif (($state == 2) && ($_ =~ $lusr)) {
- $strprn=substr($temp1, 0, length($temp1) - 1);
- print $strprn . "\n";
- $temp1 = "";
- $state = 0;
- }
- else {
- print "Error at line " . $.; exit $.;
- }
- }
- if ($state == 0) {
- print $temp1;
- }
- elsif ($state == 1) {
- print $temp0;
- }
- else {
- exit $.;
- }
- #exit $ExitValue;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement