I'm trying to find a string in a file, and when I find that string break it up and perform math on part of it. It sounds like sed
won't work because I want to do math and awk
will be difficult because I want to update the file in place.
My file looks like this (is an svn diff)
Index: code/foo.c
===================================================================
--- code/foo.c (revision 13)
+++ code/foo.c (working copy)
@@ -3,5 +3,5 @@
int main(int argc, char *argv[])
{
printf("I don't like being moved around!\n%s", bar());
- return 0;
+ return 1;
}
I'm looking for the @@
line and want to add 1 to the last number before the ending @@
. So, @@ -3,5 +3,5 @@
would become @@ -3,5 +3,6 @@