I have a file named "test" whose contents are
xxxx out of xxxxx is considered as good rating
now when I do ed test
1, $s/x*/o/g
I could not display anything. but when I use xx* in the above instead and when i do 1, $p it prints "o out of o is considered as good rating", which is a valid output as if I am not wrong xx* would replace the patterns with atleast 1 or more consecutive x's.
but x* should also replace the patterns with 0 or more x's but it is not doing that. any reasons?
thanks for the help.
because x* means xx xxx xxxx ...... and any character so everythng (include null )
# cat myfi
xxxx out of xxxxx is considered as good rating
xx* --> x + x* -> "x" + "x or any character" = must "only one x" + any
for example : x xx xxx xaasasqw xxxasa x4t4334 asasx3212..........
# sed 's/xx*/o/g' myfi
o out of o is considered as good rating
x* -> x or any character =
for example : x xx xxxx xxxxxxxxx.......... or any character (with null )
# sed 's/x*/o/g' myfi
o ooouoto ooofo o oioso ocooonosoiodoeoroeodo oaoso ogooooodo oionogo
thanks ygemici,
so what should the output be if
ed test
1, $s/x*/o/g
1, $p
is it an error.
Hi,
Why this command gives this weird output?
echo 'xxxx of xxxxx is good' | sed 's/x*/o/g'
output: o ooofo o oioso ogooooodo
Could you please explain how it is being expanded?