Alden Meneses wrote:
sorry about the confusion. i should have said the file had multiple
lines besides the two listed.
i update the file once a week. it is a file with the top 100 stocks
this newspaper puts out.
so the file will have multiple lines and I guess I am really
concerned about the last t
sorry about the confusion. i should have said the file had multiple
lines besides the two listed.
i update the file once a week. it is a file with the top 100 stocks
this newspaper puts out.
so the file will have multiple lines and I guess I am really concerned
about the last two lines as that wo
Alden Meneses wrote:
if I don't use a loop it seems that it only processes 1st two lines.
is there another way I can process the file without a loop?
In your initial post you said:
"so i have a text file that looks like this
10/04/2004 UPL TZOO CME CRDN WIBC PETD SMF
10/11/2004 UPL TZOO CME WIBC PE
thanks again - GH
if I don't use a loop it seems that it only processes 1st two lines.
is there another way I can process the file without a loop?
On Mon, 18 Oct 2004 19:02:04 +0200, Gunnar Hjalmarsson
<[EMAIL PROTECTED]> wrote:
> Alden Meneses wrote:
> > here is my updated code
> >
> > use str
Alden Meneses wrote:
here is my updated code
use strict;
use warnings;
Yeah!! :)
while(){
my @array_a = split ' ', ;
my @array_b = split ' ', ;
compare_array();
}
By declaring the arrays within a while loop, they are not accessible
outside the loop. That's why Perl complains. (Suggeste
thanks GH
here is my updated code
use strict;
use warnings;
my $file = 'C:\Documents and Settings\menesea\My
Documents\alden712\ibd100\ibd100.txt';
open(IBDIN, "<$file") || die "cannot open $file $!";
while(){
my @array_a = split ' ', ;
my @array_b = split ' ', ;
compare_array();
}
c
Alden Meneses wrote:
here is my updated code but it is not my loops are not set correctly
as I get nothing when i print to screen.
open(IBDINA, "<$file") || die "cannot open $file $!";
open(IBDINB, "<$file") || die "cannot open $file $!";
chomp(@list_a=);
chomp(@list_b=);
for ($a = 0; $a < @lis
here is my updated code but it is not my loops are not set correctly
as I get nothing when i print to screen.
open(IBDINA, "<$file") || die "cannot open $file $!";
open(IBDINB, "<$file") || die "cannot open $file $!";
chomp(@list_a=);
chomp(@list_b=);
for ($a = 0; $a < @list_a; $a+=2){
@ar
ards
- Original Message -
From: Alden Meneses <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: help on comparing lines in a text file
Date: Mon, 11 Oct 2004 22:57:51 -0700
>
> so i have a text file that looks like this
>
> 10/04/2004 UPL TZOO CME CRDN WIBC PE
Alden Meneses wrote:
> so i have a text file that looks like this
>
> 10/04/2004 UPL TZOO CME CRDN WIBC PETD SMF
> 10/11/2004 UPL TZOO CME WIBC PETD VNBC AMED
>
> anyway each line has 1 date field and 100 stock symbols and they are
> in order. I am trying to compare the different lines to see wha
Alden Meneses wrote:
so i have a text file that looks like this
10/04/2004 UPL TZOO CME CRDN WIBC PETD SMF
10/11/2004 UPL TZOO CME WIBC PETD VNBC AMED
anyway each line has 1 date field and 100 stock symbols and they
are in order. I am trying to compare the different lines to see
what has changed.
U
so i have a text file that looks like this
10/04/2004 UPL TZOO CME CRDN WIBC PETD SMF
10/11/2004 UPL TZOO CME WIBC PETD VNBC AMED
anyway each line has 1 date field and 100 stock symbols and they are
in order. I am trying to compare the different lines to see what has
changed.
so I open the file
ailto:[EMAIL PROTECTED]
Date: vendredi 23 janvier 2004 02:17
À: [EMAIL PROTECTED]
Cc: Perl Beginners
Objet: Re: Need help comparing lines in two files
Lets say file 1 is:
foo
bar
... continues on for 100 lines
And file 2 is:
foo
baz
bar
... continues on exactly the same 100 lines as file 1
Wou
2004 02:17
À: [EMAIL PROTECTED]
Cc: Perl Beginners
Objet: Re: Need help comparing lines in two files
Lets say file 1 is:
foo
bar
... continues on for 100 lines
And file 2 is:
foo
baz
bar
... continues on exactly the same 100 lines as file 1
Would file 2 be different from file 1 from line
ch $file1 (@file1){
if ("$file2" eq "$file1") {
next FILE2;
}
}
print "$file2 \n";
}
The output is "kiwi", which is exactly right.
kiwi
wolf blaum <[EMAIL PROTECTED]>
01/22/2004 08:38 PM
To
[EMAIL PROTECTE
> This very green newbie would like to compare two files, let's say File1
> and File2. I
> want to put the difference from File2 only, into a new file, File3.
I had a very simliar problem about a week ago, which James answerd here:
http://groups.google.com/groups?q=Perl+looping+(a+lot+of)
+file
On Jan 22, 2004, at 4:52 PM, [EMAIL PROTECTED] wrote:
This very green newbie would like to compare two files, let's say File1
and File2. I
want to put the difference from File2 only, into a new file, File3.
For example:
File1.txt
oranges
apples
bananas
File2.txt
apples
kiwi
bananas
The result I
One more thing, those loops I was telling you about, just using a pair
of brackets, also keep their scope. It's a good way to clean up with
yourself, i.e.
my $foo = 40;
{
my $foo = 50;
print $foo; # prints 50
# garbage collector called on all declarations before here
}
print $foo; # prints
Lets say file 1 is:
foo
bar
... continues on for 100 lines
And file 2 is:
foo
baz
bar
... continues on exactly the same 100 lines as file 1
Would file 2 be different from file 1 from line 2 and down? Or would it
be different for line 2 and 3?
Also, the keywords:
next; Brings you to the next
This very green newbie would like to compare two files, let's say File1
and File2. I
want to put the difference from File2 only, into a new file, File3.
For example:
File1.txt
oranges
apples
bananas
File2.txt
apples
kiwi
bananas
The result I want for File3 is the new entry in File2, which is
Thanks Rob,
Just what I needed to get on with my script.
Cheers,
Jakob
> -Oprindelig meddelelse-
> Fra: Rob Dixon [mailto:[EMAIL PROTECTED]
> Sendt: 1. juli 2003 21:19
> Til: [EMAIL PROTECTED]
> Emne: Re: Comparing lines
>
>
> Jakob Kofoed wrote:
> > Hi a
Jakob Kofoed wrote:
> Hi all,
>
> I have a file with several columns of numbers, that I want to make sure that
> they are either increasing or are equal to the previously line - if not then
> give a warning.
>
> E.g.
>
> my input file:
>
> 1 2
> 3 3
> 5 4
> 7 5
> 6 6 << Error in column o
Hi all,
I have a file with several columns of numbers, that I want to make sure that
they are either increasing or are equal to the previously line - if not then
give a warning.
E.g.
my input file:
1 2
3 3
5 4
7 5
6 6 << Error in column one
8 7
I tried to do a foreach loop but cou
23 matches
Mail list logo