CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
anonimysing SGML

 



achab
New User

Sep 7, 2011, 2:47 PM

Post #1 of 2 (510 views)
anonimysing SGML Can't Post

Hi,

I need some help, I am really in a hurry. Time for auto-training will come later.

I have around 200 file to anaominyse this way:
---]
<KEY>A12311111111</KEY>
<QUOTE> blablabla blabla blabla bla 154 blablabla </QUOTE>
[---

Doit donner apres traitement:

---]
<KEY>A12311111111</KEY>
<QUOTE> xxxxxxxxx xxxxxx xxxxxx xxx 154 xxxxxxxxx </QUOTE>
[---

thanks a lots

Philippe


wickedxter
User

Sep 7, 2011, 4:07 PM

Post #2 of 2 (509 views)
Re: [achab] anonimysing SGML [In reply to] Can't Post

 


Code
 
open FILE, "/dir/to/file.db";
open OUT, ">>/dir/to/output.db";
while (my $line = <FILE>){

if($line =~ /\<QUOTE\>/){
$line =~ /\<QUOTE\>( .*)(\d*)(.*)\<\/QUOTE\>/;
my $replace = $1;
my $replace2 = $3;

$replace =~ tr/\w/x/;
$replace2 =~ tr/\w/x/;

print OUT "<QUOTE> $replace" . $2 . $replace2 . "</QUOTE>\n";

} else {
print OUT "$line\n";

}
close FILE;
close OUT;



This is untested and the lazy way by far......


(This post was edited by wickedxter on Sep 7, 2011, 4:12 PM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives