[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Søg og erstat -> Hurtigt hack ønskes!



perl -i -pe 's/andeby/gåserød/gi'
er en sød lille ordre til at erstatte alle andeby med gåserød.

Men hvad gør jeg midt i et Perl program, hvis jeg har 
filnavn : $filename
frastreng : $froms
tilstreng : $tos

og vil erstatte alle $froms med $tos i $filename
resultatet skal også efterlades i $filename.

Er metoden at læse filen ind selv og lave søg og erstat
og skrive filen ud i et temporært filnavn og derefter
flytte filen? Gætter på at det kan gøres meget mere
kompakt svarende til første linie af denne mail.

;-)

Peter Toft, Ph.D. sslug@sslug http://www.sslug.dk/~pto

"Unix? What's that? Is that like Linux?"





 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 19:52 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *