Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [GUILT PATCH 1/4] get_series: Remove comments from end of series lines

From: Eric Lesh <hidden>
Date: 2016-06-15 22:43:24

[ Do you mind if these messages go to both your email addresses, or
should I remove one or the other? ]

Josef Sipek [off-list ref] writes:
On Sun, Jul 29, 2007 at 12:50:15AM -0700, Eric Lesh wrote:
... 
quoted
diff --git a/guilt b/guilt
index f67bfb5..774909e 100755
--- a/guilt
+++ b/guilt
@@ -178,7 +178,8 @@ get_series()
 	#	- whitespace only
 	#	- optional whitespace followed by '#' followed by more
 	#	  optional whitespace
-	grep -ve '^[[:space:]]*\(#.*\)*$' "$series"
+	# also remove comments from end of lines
+	grep -ve '^[[:space:]]*\(#.*\)*$' < "$series" | sed -e 's/[[:space:]]*#.*$//'
I'd be tempted to replace the whole thing with one sed script...something
like (not tested):

"
/^[[:space:]]*#/ ! {
	s/[[:space:]]*#.*$//

	p
}
"
sed -e "/^[[:space:]]*\(#.*\)*$/d
	/^[[:space:]]*\(#.*\)*$/!{
	s/[[:space:]]*#.*$//
	}
	" $series

is the best I can do.

sed -e "/^[[:space:]]*\(#.*\)*$/d" -e "s/[[:space:]]*#.*$//" $series

works too, and is maybe more readable.

My sed-foo is weak, though.

	Eric
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help