maybe this does not ineterest you, but:
if you wanna substitute each code (for instance 010) with its correct name (for instance red) you can use thw script that follows.
Actually I'm working on apply this script to an entire directory and its subdirectories (see the mail "navigate the directories").
hope to be useful.

all'adr

~~~~~~~~~~~~~~~THE SCRIPT~~~~~~~~~~~~~~~~~~~



#!/usr/bin/perl -w
# extracts from a file two arrays of related words
# searches in a file the first word of any couple (in the first array) and
# substitute it with its related words in the second array
# then print the correct file
use strict;

my $fileNinput = "INciccio.txt";
my $fileNoutput = "OUTciccio.txt";
my ($firstnames,$secondnames,@firstnames,@secondnames,@badnames);
my $num = 0;

open (INPUT, $fileNinput) or die "File not opnd cos $!";
my @names = <INPUT>;
foreach my $name (@names) {
#this regexp depends on your text formatting
if ($name =~ /(\S+) "(\S+)/) {
push @firstnames, $1;
push @secondnames, $2;
}
else {
# Invalid formatted name
push @badnames;
}
}
close (INPUT);

open (INPUT, $fileNoutput);
while (<INPUT>)
{
foreach $firstnames (@firstnames){
s/$firstnames/$secondnames[$num]/g;
$num ++;
}
print;
}
close (INPUT);


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to