[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
 

Re: [TEKNIK] Søg og erstat



Hej Erik.

>Jeg håbede lidt på at nogen kunne hjælpe mig med at finde ud af hvordan
man laver en søg og erstat, på indholdet i mange forskellige filer på engang.
>
>Der er f.eks 200 tekstfiler i et directory, og i alle disse filer skal en
bestemt sætning skiftes ud med noget andet.

Brug sed og noget i stil med følgende (afhænger lidt af din shell - se "man
foreach"):

foreach file ( *.txt )
sed -e 's/gammel/ny/g' $file > temp.out
mv temp.out > $file
end

Husk at checke din substitution (fra 'gammel' til 'ny') inden du kører
ovenstående, så du ikke får erstattet for meget!

Mvh,

Claus



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 21:38 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] *