File operations

O

Olita Olita

Hi,
could you tell me how to compare 2 files (if a block of the first file
contains the second file).
for example.
file 1:
<body>
-----
-----
-----
<script>
AAAA
</script>
<script>
xxxxx
yyyyy
</script>
</body>
file 2:
</script>
<script>
xxxxx
yyyyy
</script>

I need to verify if the content of the 2nd file is present on the first
file
I hope you can help me with this
 
T

Tiziano Merzi

Olita said:
Hi,
could you tell me how to compare 2 files (if a block of the first file
contains the second file).

You can load the two files in two strings

str1 = IO.read("file1")
str2 = IO.read("file2")

and now search if str2 is contained in str1

... if str1.include? str2

tiziano
 
O

Olita Olita

Tiziano said:
You can load the two files in two strings

str1 = IO.read("file1")
str2 = IO.read("file2")

and now search if str2 is contained in str1

... if str1.include? str2

tiziano


thank you :) ... it's working now :D

Olita
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,276
Messages
2,571,384
Members
48,072
Latest member
FaustoBust

Latest Threads

Top