How can I replace some words 1-5 lines after the matched line ?

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

 



Hi!
I am trying to write a script to replace some words 1-5 lines after the
matched line. For example, here is some part in kernel-2.4.spec,
...
# Second, per-architecture exclusions (ifarch)
%ifarch i386
%define buildsmp 0
%define buildup 0
%endif
%ifarch i586
%define buildsmp 0
%endif
...
I am trying to match the "%ifarch i386", and then I would like to make
the "%define buildup" to be "1", also if the search match the "%ifarch
i586",  I would like to make the "%define buildsmp" to be 1. How can I
make it ?
If I use perl or sed, it can only replace the word in the matched line,
not the following lines. What's the better solution ?

Thanks in advance.
-- 
Steven Shiau





[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux