On Wed, 2011-10-12 at 19:49 -0400, S. Martinez wrote:
> On 10/12/2011 07:10 PM, Marcos Pansani wrote:
> > GStreamer Good Plug-ins, GStreamer Ugly Plug-ins
> >
> > sed -i '/ase --o/s/ \{8\}/\t/' docs/plugins/Makefile.in
> >
> >
> > with it compiles without errors.
>
> Thank you for this. I realize that this may not be the appropriate
> place to ask this, but can you (or anyone else) give me a quick
> explanation of part of your sed command?
>
> Specifically, I understand what the -i switch does as well as the s/
> \{8\}/\t/ part, i just don't understand the /ase --o/ part.
>
> Again, thanks for all of the help!
Ok, so basically, there are two parts to the expression. The first is a
rule to identify a specific line (or lines) in the file:
/ase --o/
So, match any line in the file containing the string "case --o". The
second part is the substitution, which applies to the lines matched by
that first expression:
s/{8\}/\t/
So collectively, the expression finds all lines containing "case --o",
and for only those lines, replaces the first occurrence of eight spaces
with a single tab.
It's not a syntax I've seen often with substitutions, but pretty much
all sed commands can be prefixed with a pattern like that, to limit
which lines they apply to. A more common example would be using
something like /pattern/d to match all lines containing "pattern", and
delete them.
Simon.
signature.asc
Description: This is a digitally signed message part
-- http://linuxfromscratch.org/mailman/listinfo/blfs-support FAQ: http://www.linuxfromscratch.org/blfs/faq.html Unsubscribe: See the above information page
