I need to find to find duplicate lines in a document and then print the line numbers of the duplicates
The files contain multiple lines with about 100 numbers on each line I need something that will output the line numbers where duplicates were found ie 1=5=7, 2=34=76
Any suggestions would be... (5 Replies)
Hi All,
Can Anyone please tell me,how can I delete a line from a file.
I am reading the file line by line using whil loop and validating each line..Suppose in the middle i found a particular line is invalid,i need to delete that particular line.
Can anyone please help.
Thanks in advance,... (14 Replies)
Hello,
I have two files. File1 or the master file contains two columns separated by a delimiter:
a=b
b=d
e=f
g=h
File 2 which is the file to be processed has only a single column
a
h
c
b
What I need is an awk script to identify unique names from file 2 which are not found in the... (6 Replies)
Hello,
I have a large database in which name homonyms are arranged in a row. Since the database is large and generated by hand, very often dupes creep in. I want to remove the dupes either using an awk or perl script.
An input is given below
The expected output is given below:
As can be... (2 Replies)
Hi
I have a file:
r58778.3|SOURCES={KEY=f665931a...,fw,221-705}|ERRORS={16_1:T,30_1:T,56_1:C,57_1:T,59_1:A,101_1:A,115:-,158_1:C,186_1:A,204:-,271_1:T,305:-,350_1:C,368_1:G,442_1:C,472_1:G,477_1:A}|SOURCE_1="Contig_1092402550638"(f665931a359e36cea0976db191ff60ff09cc816e)
I want to retain... (15 Replies)
Hello,
I have a database of name variants with the following structure:
variant=variant=variant
The number of variants can be as many as thirty to forty.
Since the database is quite large (at present around 60,000 lines) duplicate sets of variants creep in. Thus
John=Johann=Jon
and... (2 Replies)
Dear all,
I have a large dictionary database which has the following structure
source word=target word
e.g.
book=livre
Since the database is very large in spite of all the care taken, it so happens that at times the source word is repeated
e.g.
book=livre
book=tome
Since I want to... (7 Replies)
Hello,
I have a script which removes duplicates in a database with a single delimiter
=
The script is given below:
# script to remove dupes from a row with structure word=word
BEGIN{FS="="}
{for(i=1;i<=NF;i++){a++;}for(i in a){b=b"="i}{sub("=","",b);$0=b;b="";delete a}}1
How do I modify... (6 Replies)
Hi,
I have a shell script which has a for loop that scans list of files and do find and replace few variables using sed command. While doing this, it deletes the last line of all input file which is something wrong. how to fix this. please suggest. When i add an empty line in all my input file,... (5 Replies)
Discussion started by: rbalaj16
5 Replies
LEARN ABOUT CENTOS
extutils::packlist
ExtUtils::Packlist(3pm) Perl Programmers Reference Guide ExtUtils::Packlist(3pm)NAME
ExtUtils::Packlist - manage .packlist files
SYNOPSIS
use ExtUtils::Packlist;
my ($pl) = ExtUtils::Packlist->new('.packlist');
$pl->read('/an/old/.packlist');
my @missing_files = $pl->validate();
$pl->write('/a/new/.packlist');
$pl->{'/some/file/name'}++;
or
$pl->{'/some/other/file/name'} = { type => 'file',
from => '/some/file' };
DESCRIPTION
ExtUtils::Packlist provides a standard way to manage .packlist files. Functions are provided to read and write .packlist files. The
original .packlist format is a simple list of absolute pathnames, one per line. In addition, this package supports an extended format,
where as well as a filename each line may contain a list of attributes in the form of a space separated list of key=value pairs. This is
used by the installperl script to differentiate between files and links, for example.
USAGE
The hash reference returned by the new() function can be used to examine and modify the contents of the .packlist. Items may be
added/deleted from the .packlist by modifying the hash. If the value associated with a hash key is a scalar, the entry written to the
.packlist by any subsequent write() will be a simple filename. If the value is a hash, the entry written will be the filename followed by
the key=value pairs from the hash. Reading back the .packlist will recreate the original entries.
FUNCTIONS
new()
This takes an optional parameter, the name of a .packlist. If the file exists, it will be opened and the contents of the file will be
read. The new() method returns a reference to a hash. This hash holds an entry for each line in the .packlist. In the case of old-
style .packlists, the value associated with each key is undef. In the case of new-style .packlists, the value associated with each key
is a hash containing the key=value pairs following the filename in the .packlist.
read()
This takes an optional parameter, the name of the .packlist to be read. If no file is specified, the .packlist specified to new() will
be read. If the .packlist does not exist, Carp::croak will be called.
write()
This takes an optional parameter, the name of the .packlist to be written. If no file is specified, the .packlist specified to new()
will be overwritten.
validate()
This checks that every file listed in the .packlist actually exists. If an argument which evaluates to true is given, any missing
files will be removed from the internal hash. The return value is a list of the missing files, which will be empty if they all exist.
packlist_file()
This returns the name of the associated .packlist file
EXAMPLE
Here's "modrm", a little utility to cleanly remove an installed module.
#!/usr/local/bin/perl -w
use strict;
use IO::Dir;
use ExtUtils::Packlist;
use ExtUtils::Installed;
sub emptydir($) {
my ($dir) = @_;
my $dh = IO::Dir->new($dir) || return(0);
my @count = $dh->read();
$dh->close();
return(@count == 2 ? 1 : 0);
}
# Find all the installed packages
print("Finding all installed modules...
");
my $installed = ExtUtils::Installed->new();
foreach my $module (grep(!/^Perl$/, $installed->modules())) {
my $version = $installed->version($module) || "???";
print("Found module $module Version $version
");
print("Do you want to delete $module? [n] ");
my $r = <STDIN>; chomp($r);
if ($r && $r =~ /^y/i) {
# Remove all the files
foreach my $file (sort($installed->files($module))) {
print("rm $file
");
unlink($file);
}
my $pf = $installed->packlist($module)->packlist_file();
print("rm $pf
");
unlink($pf);
foreach my $dir (sort($installed->directory_tree($module))) {
if (emptydir($dir)) {
print("rmdir $dir
");
rmdir($dir);
}
}
}
}
AUTHOR
Alan Burlison <Alan.Burlison@uk.sun.com>
perl v5.16.3 2013-03-04 ExtUtils::Packlist(3pm)