[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sed, bash script



On Fri, Sep 19, 2003 at 05:14:15AM +0800, csj wrote:
...
> > 
> > >>On Tue, Sep 16, 2003 at 07:39:39AM -0700, Ric Otte wrote:
> > >>    
> > >>
> > >>>Hi, I would like to run all of the files in some directories
> > >>>through sed, in order to edit the files.  I can do it for
> > >>>individual files by typing: cat filename|sed command>filename
> > >>>But that requires me to run that command for each file.  I
> > >>>was wondering if anyone could 1) give me a reference to a
> > >>>simple bash tutorial that will explain how to set up a script
> > >>>to do things like this,
...
> 
> sed -i -f sed_script *.foo
> 
> ...

That's nice, but the version of sed available with woody/stable doesn't
provide that option.  What version are you using?

    $ sed -i 
    sed: invalid option -- i
    Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...
    ...
    $ dpkg -l sed
    ...
    ii  sed                 3.02-8              The GNU sed stream editor.
    $ sed -V
    GNU sed version 3.02
    
    Copyright (C) 1998 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE,
    to the extent permitted by law.

>From a search on packages.debian.org:

    Release  Package (size)
    stable sed 3.02-8   (100.4k)
      The GNU sed stream editor.
    testing sed 4.0.7-1   (184k)
      The GNU sed stream editor
    unstable sed 4.0.7-1   (184k)
      The GNU sed stream editor

Ken

-- 
Ken Irving, Research Analyst, fnkci@uaf.edu, 907-474-6152
Water and Environmental Research Center
Institute of Northern Engineering
University of Alaska, Fairbanks



Reply to: