Re: parsing script help please

2012-05-31 Thread nathalie
You want something like this: #!/software/bin/perl use warnings; use strict; my $file = "example.txt"; open my $in, '<', $file or die "Cannot open '$file' because: $!"; while ( <$in> ) { next if /^#/; chomp; my ( $key, @fields ) = split /\t/; print map "$key\t$_\n", @fields;

Re: parsing script help please

2012-05-31 Thread nathalie
thanks a lot Rob I would like an output without the $VAR... so I did add this after the push function and it is perfect, thanks a lot again foreach my $number(@othernumbers){print $rownum,"\t",$elet, "\n";} #!/usr/local/bin/perl use strict; use warnings; my $fh; my %results; open ( $fh,

Re: parsing script help please

2012-05-31 Thread John W. Krahn
nathalie wrote: Hi Hello, I have this format of file: (see attached example) 1 3206102-3207048 3411782-3411981 3660632-3661428 2 4481796-4482748 4483180-4483486 and I would like to change it to this 1 3206102-3207048 1 3411782-3411981 1 3660632-3661428 2 4481796-4482748 2 4483180-4483486

Re: parsing script help please

2012-05-31 Thread Rob Coops
On Thu, May 31, 2012 at 11:37 AM, nathalie wrote: > > > Hi > I have this format of file: (see attached example) > 1 3206102-3207048 3411782-3411981 3660632-3661428 > 2 4481796-4482748 4483180-4483486 > > > and I would like to change it to this > 1 3206102-3207048 > 1 34117

parsing script help please

2012-05-31 Thread nathalie
Hi I have this format of file: (see attached example) 1 3206102-3207048 3411782-3411981 3660632-3661428 2 4481796-4482748 4483180-4483486 and I would like to change it to this 1 3206102-3207048 1 3411782-3411981 1 3660632-3661428 2 4481796-4482748 2 44

RE: [Perl-unix-users] Script Help Please

2001-11-26 Thread Steve Aaron
1 2:50 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: [Perl-unix-users] Script Help Please Steve, I made the correction as follows: if (/\bUP\b/ && /$server_name/) Does not work. I also tried: if (/$server_name/) Does not work. And: if (/\b$server_name

Re: Script Help Please

2001-11-26 Thread Randal L. Schwartz
> "Craig" == Craig Sharp <[EMAIL PROTECTED]> writes: Craig> my %servers; (This is defining a hash?) Craig> open (I understand) Craig> { Craig> chomp (my @temp = ); (Removing the newline from each entry) Craig> @server{ @temp } =(); (What's this do?); Craig> } It's a hash slice, which contra

Re: Script Help Please

2001-11-26 Thread Craig Sharp
John, Thanks for the info. I am a bit confused in the first part of the script. my %servers; (This is defining a hash?) open (I understand) { chomp (my @temp = ); (Removing the newline from each entry) @server{ @temp } =(); (What's this do?); } Thanks, Craig >>> "John W. Krahn" <[EMAIL PROT

Re: Script Help Please

2001-11-26 Thread John W. Krahn
Craig Sharp wrote: > > I am lost. I have the following script that opens the log file WUGEvent.log and >looks for the > statment "UP", replaces spaces and writes out the new log file. It works great! > > Here is the problem. I need to read in another file (wuglist.txt) containing a list >of

RE: [Perl-unix-users] Script Help Please

2001-11-26 Thread Craig Sharp
hat occurs least frequently on the left of the && as the right-hand side is only evaluated if the left-hand expression returns true. Steve Aaron -Original Message- From: Craig Sharp [mailto:[EMAIL PROTECTED]] Sent: Monday, November 26, 2001 12:45 PM To: [EMAIL PROTECTED] Cc:

RE: Script Help Please

2001-11-26 Thread Jonathan E. Paton
> Can anyone confirm if I understand this right: > > if ( $username =~ /@/ ) > { >$_ = $username; >($username) = /(.*)\@/; > } > > The part > ($username) = /(.*)\@/; > removes the @ symbol? Yes, but what if you've got two @'s? ;-) The two lines in the 'if' can be rewritten as: $us

RE: [Perl-unix-users] Script Help Please

2001-11-26 Thread Steve Aaron
PROTECTED]] Sent: Monday, November 26, 2001 12:45 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [Perl-unix-users] Script Help Please Hi all, I am lost. I have the following script that opens the log file WUGEvent.log and looks for the statment "UP", replaces spaces and writes

RE: Script Help Please

2001-11-26 Thread Scott Ryan
November 2001 12:45 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Script Help Please Hi all, I am lost. I have the following script that opens the log file WUGEvent.log and looks for the statment "UP", replaces spaces and writes out the new log file. It works great! Here is the p

Script Help Please

2001-11-26 Thread Craig Sharp
Hi all, I am lost. I have the following script that opens the log file WUGEvent.log and looks for the statment "UP", replaces spaces and writes out the new log file. It works great! Here is the problem. I need to read in another file (wuglist.txt) containing a list of server names and then