I have to replace all . characters before the = character in every line in a file.The lines are like this:one.two.three=somethingfour.five=1six.seven=127.0.0.1eight.nine.ten.eleven=somethingwerylongtwelve=something.with.dotsand so on...The result must be like this:onetwothree=somethingfourfive=1sixseven=127.0.0.1eightnineteneleven=somethingwerylongtwelve=something.with.dots
Replace with sed until match in a line
text processing;sed
sed -e :1 -e 's/^\([^=]*\)\./\1/; t1't1 branches to the 1 label if there has been a successful s command. That's one of the ways to implement conditional loops in sed.Or:awk -F = -v OFS== '{gsub(/\./, , $1); print}'