Looking for a solution in bash (will be part of a larger script).
Given a variable containing information of the form
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 wish to extract both (here diff.txt and myfile.c, but future cases will not be limited to this number) filenames to a string of the form "edited: filename1 filename2 ... filenameN".
To clarify, I wish to extract multiple matching filenames to a string.
- The command "$(expr "$editing" : '.*---[[:space:]]\([[:graph:]]*\)[[:space:]]')" returns the last filename correctly but not previous instances.
EDIT: Require the ability to identify edited filenames (possibly including spaces) i.e. filenames appearing after "---" and before the day "Fri/Thu...".
Thanks for your help (and to the many people have replied thus far).