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

Re: grep | sed do not function inline?



Michelle Konzack said:

Am 2007-04-22 19:32:18, schrieb nicholas:
I've seen the same thing with tail -f, and it confuses me as well.
I look forward to an expert answer!

In this case, sed alone can handle the job, if you want to avoid perl:

 tail -f mylog | sed -n '/smtg/s/end/notend/p'

  tail -f mylog | sed -n '/smtg/,s/end/notend/p'
                                ^

What is the comma supposed to do? It looks like the start of a range, but
there's no end to it. When I try it, sed complains:

$ tail -f mylog | sed -n '/smtg/,s/end/notend/p'
sed: -e expression #1, char 8: unexpected `,'
$ sed --version
GNU sed version 4.1.2
Copyright (C) 2003 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.
$



Reply to: