The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Need help to modify perl script: Text file with line and more than 1 space srsahu75 Shell Programming and Scripting 3 03-20-2009 05:28 PM
Perl/shell script count the lines pistachio UNIX for Dummies Questions & Answers 3 09-24-2008 05:26 PM
HELP! PERL script to find matched pattern kimhuat Shell Programming and Scripting 1 05-12-2008 11:24 AM
Perl Script Error with find command MKNENI Shell Programming and Scripting 4 03-26-2008 12:02 PM
Modify Perl script to work with txt - Permissions script joangopan Shell Programming and Scripting 1 09-13-2007 12:38 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 03-31-2009
richsark richsark is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 92
Modify a perl script to find and count

Hello all !I have two sets of folders that have IP address from two sources.The below perl script I was working with needs some corrections.I am looking for the perl script to identify and count what IP address are found to be duplicated between both files.The format from both files are the same meaning IP addresses100.100.100.2
I am hopefull to get a report like so:
The report should contain a list of objects found in both datasets. For example:

"The following objects were found in both file A and File B:
10.1.1.1
10.2.2.1

With what I have I noticeing an error off the bat. Mind you I am not an expert in perl

syntax error at E:\dup2.pl line 10, near "print"Execution of E:\dup2.pl aborted due to compilation errors.
Thanks


#!perl

@ARGV=<E://rich//file-A-obj_prof.out.txt E://rich2//File-B-obj_prof-out.txt *>;
while( <> ){
next if /^#/;
print if $count{(split)[-1]}{$ARGV}++;
}
my %in;
push @{$in{join' and ',sort keys %{$count{$_}}}},$_ for sort grep{%{$count{$_}} > 1} keys %count
print join"\n","the following files appear in $_",@{$in{$_}},"" for keys %in;

Last edited by richsark; 03-31-2009 at 12:47 PM.. Reason: text format
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:15 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0