On 6/11/25 3:08 PM, Josh Poimboeuf wrote: > On Wed, Jun 11, 2025 at 02:44:35PM -0400, Joe Lawrence wrote: >>> +get_patch_files() { >>> + local patch="$1" >>> + >>> + grep0 -E '^(--- |\+\+\+ )' "$patch" \ >>> + | gawk '{print $2}' \ >> If we split the rest of this line on the tab character and print the >> first part of $2: >> >> gawk '{ split($2, a, "\t"); print a[1] }' >> >> then it can additionally handle patches generated by `diff -Nupr` with a >> timepstamp ("--- <filepath>\t<timestamp>"). > Hm? The default gawk behavior is to treat both tabs and groups of > spaces as field separators: > > https://www.gnu.org/software/gawk/manual/html_node/Default-Field- > Splitting.html > > And it works for me: > > $ diff -Nupr /tmp/meminfo.c fs/proc/meminfo.c > /tmp/a.patch > $ grep -E '^(--- |\+\+\+ )' /tmp/a.patch | gawk '{print $2}' > /tmp/meminfo.c > fs/proc/meminfo.c > > Or did I miss something?
Ah hah, I fixed up the code in refresh_patch() with that double gawk, and then noticed it could have just called get_patch_files() instead. So yeah, you're right, the simple gawk '{print $2}' handles both cases already :) -- Joe