On Sun, 2012-05-06 at 21:02 +0430, Yasser Zamani wrote:
> Thanks a lot Simon,
> 
> As I cited, the book is well described enough but I worried a bit when
> I saw a 'sed' script at first time. However, as the mailing list's
> friends advised, after learning a bit online, now I don't have any
> trouble with 'sed' expressions at book :)
> 
> Here, I would like to write down what I learned just in few lines for
> helping whom reach this thread via searching the mailing list:
> 
>      1. sed stands for 'stream editor'
>      2. Streams are bytes which are traveling e.g. byte[] is an array
>         but when you send it's items one by one to a destination then
>         it's a stream.

Better to say characters, than bytes. They *are* bytes, of course, but
as a tool for dealing with text, sed views the stream as a stream of
characters. And a character isn't always a single byte.

>              1. Exampl 2: echo 'Welcome to LFS' | sed 's@[A-Z]@*&@g'
>                      1. A bit more complicated, right? but not at all
>                         when I describe it:

Oh, that's not complicated at all. Somewhat offtopic for LFS, but try
this one, used in a script I wrote for work... basically it parses and
reformats the output of our version control tools...

  sed -n '
    /version ".*"/h;
    /activity:.*@/{
      H; g
      s/.*version "\(.*\)".*activity:\(.*\)@\/vobs.*/\2 - \1/
      p
    }'


Simon.

Attachment: signature.asc
Description: This is a digitally signed message part

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to