So I have this sed command applied on $1 wich is a file
what I’d like to know is how sed evaluates all the slash, backslash
succession and what does any character in the pattern mean
sed '/^\/\*/d/.*\*\//d' $1
as far as I know
'/^ ....../d'
deletes some pattern at the begining of line (considering the second d)
-what does the first d stand for, what about the dot and the / or /\ (unescape chars?)
could please someone explain this to me please ?
This is actually two sed commands back to back:
^matches start of line,\/matches a literal forward-slash,\*matches a literal asterisk. (Since forward-slash and asterisk are “meta-characters”, they need to be escaped with a backslash to match literally.).*matches any sequence of characters,\*matches a literal asterisk again,\/matches a literal slash again.Put it all together, and what this does is to delete C-style comments, but only if they appear at the start of a line: