WebFaction
Community site: login faq

I am using below script to compare two files UEDP35.txt and BB_UEDP35.txt. This script work well if i give inputs manually. Now i need something more. anyone please help.

Inside one folder i have n numbers of files same like UEDP35.txt. for eg: UEDP1.txt,UEDP2.txt,UEDP3.txt... Same like another file BB_UEDP35.txt for eg: BB_UEDP1.txt,BB_UEDP2.txt,BB_UEDP3.txt... here UEDP is common is both files name. If this UEDP are same, then i want to give those two files as inputs. If any different occur while comparing then that has to export into another new file. This has to be done as loop.

use warnings;

use strict;

open AIN, "<UEDP35.txt ";

open BIN, "<BB_UEDP35.csv";

my %seen;

while (<ain>) {

my $v = (split(/,/))[0];

$seen{$v}++;

}

while (<bin>) {

my $v=(split)[0];

print "$vn" if not $seen{substr($v, 0, 5)};

}

close AIN;

close BIN;

asked 26 Jul '12, 11:16

valeria
12
accept rate: 0%

edited 26 Jul '12, 11:29


There are some good examples for iteration here here, you could use count++ in a similar way.

permanent link

answered 26 Jul '12, 20:38

johns
5.4k312
accept rate: 23%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×20
×16
×2

question asked: 26 Jul '12, 11:16

question was seen: 2,386 times

last updated: 26 Jul '12, 20:38

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM