[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

regex lesson (again)



i am reading through the init script for iptables, and i am not certain
how this regex is doing what its doing:

grep -v "^[[:space:]]*#"

or this one

grep -v '^[[:space:]]*$'

the grep -v i understand, but what is going on with this

	^[[:space:]]*#

	^ 		beginning
	[ 		grouping
	[:space:]	is this some sort of way to indicate
			whitespace or something?
	]		end of group
	* 		any number of this grouping
	#		a literal pound

i am pretty sure that this is just a grep for any line that has some/no
whitespace and then a literal # character. so, i assume this is grepping
for lines that do not begin with a comment. i am just curious as to know
how exactly its working.
the second regex looks to be grepping for lines that are strictly
whitespace (or in the case of -v lines that are not strictly whitespace.)

thanks

-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.