For example, given:
$ cat test001.txt this is a test bucket bucket line not this one. bucket lein endy bucket and others endy and a ttest How can I change the lines that start with "bucket" with "(bucket", ignoring spaces?
So far I have:
sed -i 's/^\sbucket/bucket(/g' test001.txt but that doesn't work (no change and no error). Then I would like to only do it for lines that also end with 'endy' (so only 2 of the 3 bucket lines).
sed -i 's/^[[:space:]]*bucket.*endy/(bucket/g' test001.txt..for any character and*for zero or more (greedy).