Regular Expressions in sed

P

ping83416

Guest
What is the function of [0-9]* in the following statement, which will write all lines that start with an even number, followed by a space, to the file even:

sed -n 's/^[0-9]*[02468] /&/w even' <file

Then, eliminate [0-9]* will have the same function/output. In other words, both statements are the same effect.

sed -n 's/^[02468] /&/w even' <file

Is [0-9]* useless here? I am really confuse. Please help me.
 

Members online


Top