[PLUG] requesting help with sed...

Vaibhav Kulkarni netvaibhav at gmail.com
Tue Nov 17 10:50:36 PST 2009


On Tue, Nov 17, 2009 at 2:05 PM, Sameer Oak <samoak at gmail.com> wrote:
> ALL,
>
> I need help with a particular sed pattern.
>
> I am maintaining a version file wherein I need to search for a line that
> starts with "build_number_i".
> Following are the contents of the file:
> build_type_i=i
> build_number_i=1
> branch_name_i=trunk
> build_id=1
>
> Each line is of the form <variable_name>=<value>
>
> I want to increment value of variables "build_number" and "build_id" by 1.
>
> How can I achieve it with sed?

I would say sed is not the right tool for this job, although you can
do some hacks to increment a number:

http://www.gnu.org/software/sed/manual/sed.html#Increment-a-number

Vaibhav



More information about the plug-mail mailing list