Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Open Source > Perl
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Perl section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 3rd, 2007, 10:03 AM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to nmnm
Default delete the duplicated sentencs without considering

i have this type of following sentences in a file.i want to delete the duplicated sentencs without considering the space difference.for eg: in the following sentences i want to delete both first and 3rd sentences starting with bs5019 because they are the same .i am only a starter in perl so pls help i tried it a lot but it considers that space also.expecting your reply.



bs5019 error: The document contains 68 carriage return characters
rol50141 error: The of element intra-ref is not correctly formatted.
bs5019 error: The document contains 68 carriage return characters


thank you


Reply With Quote
  #2 (permalink)  
Old August 30th, 2007, 07:33 AM
Friend of Wrox
Points: 1,515, Level: 15
Points: 1,515, Level: 15 Points: 1,515, Level: 15 Points: 1,515, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2003
Location: Oxford, , United Kingdom.
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Quote:
quote:i want to delete both first and 3rd sentences starting with bs5019 because they are the same
I think this is what you're after - this works on a *nix box.

Code:
charlie@maui $ cat b
bs5019 error: The document contains 68 carriage return characters
rol50141 error: The of element intra-ref is not correctly formatted.
bs5019 error: The document contains 68 carriage return characters

charlie@maui $ cat filt.pl

#!/usr/bin/perl
use warnings;
use strict;

my %hash;

while (<>){
  next if ($hash{$_});
  $hash{$_}=1;
  print;
}

charlie@maui $ cat b | ./filt.pl
bs5019 error: The document contains 68 carriage return characters
rol50141 error: The of element intra-ref is not correctly formatted.
charlie@maui $
--
Charlie Harvey's website - linux, perl, java, anarchism and punk rock: http://charlieharvey.org.uk
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I prevent duplicated rows in a subtotal lsouza Crystal Reports 2 May 8th, 2007 11:23 AM
Duplicated assemblies in setup project eelisMX VS.NET 2002/2003 1 July 31st, 2006 08:05 AM
Finding values from duplicated nodes swwallace XSLT 1 March 2nd, 2006 05:21 AM
Need Help on Filtering duplicated data fanyin XSLT 2 November 4th, 2004 08:06 PM
How to suppress the duplicated fields? (formula) winnie1778 Crystal Reports 0 October 18th, 2003 05:56 AM



All times are GMT -4. The time now is 09:57 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.