Looking for a solution in bash (will be part of a larger script).
Given a variable containing form information
diff -r efb93662e8a7 -r 53784895c0f7 diff.txt
--- diff.txt Fri Jan 23 14:48:30 2009 +0000
+++ b / diff.txt Fri Jan 23 14:49:58 2009 +0000
@@ -1.9 +0.0 @@
-diff -r 9741ec300459 myfile.c
---- myfile.c Thu Aug 21 18:22:17 2008 +0000
- +++ b / myfile.c Thu Aug 21 18:22:17 2008 +0000 -@ @ -1.4 +1.4 @@
- int myfunc ()
- {
- return 1;
- + return 10;
-}
I want to extract both (here diff.txt and myfile.c, but future cases will not be limited to this number) file names in the form line "edited: filename1 filename2 ... filenameN".
To clarify, I want to extract a few matching file names into a string.
- The command "$ (expr" $ editing ": '. * --- [[: space:]] \ ([[: graph:]] * \) [[: space:]]')" returns the last file name correctly but not the previous ones.
EDIT: Requires the ability to identify edited file names (possibly including spaces), that is, file names that appear after "---" and until the day "Fri / Thu ...".
Thank you for your help (and many people have answered so far).
source share