perl -pi -e 's/oldtext/newtext/' * >>> phd@xxxxxxxxxxxxxx 03/28/03 12:27PM >>> Hi, Good answer, but if your want to replace all "search" terms in a line (and not only the first found), just add the "g" parameter at the end of sed command : (g = globally)... for file in `ls` ; do cat $file | sed 's/search/replace/g' > $file.new ; > done If I make no mistake, as I did not use it for a long time, but used to work with it in my former job. Cheers, -- Philippe, Chiangmai, Thailand On Fri, 2003-03-28 at 21:35, Piero Calucci wrote: > On Fri, 2003-03-28 at 15:15, ghwbush wrote: > > I have a directory of about 60 files. I want to search these files and > > replace some text. Is there an easy way to do this from a command > > line? > > for file in `ls` ; do cat $file | sed 's/search/replace/' > $file.new ; > done > > assuming you are searching for "search" and want to replace it with > "replace" > > Piero -- Psyche-list mailing list Psyche-list@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/psyche-list -- Psyche-list mailing list Psyche-list@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/psyche-list