我必须替换所有“。”文件中每一行中“=”字符之前的字符。这些行是这样的:
one.two.three=something
four.five=1
six.seven=127.0.0.1
eight.nine.ten.eleven=somethingwerylong
twelve=something.with.dots
等等...
结果一定是这样的:
onetwothree=something
fourfive=1
sixseven=127.0.0.1
eightnineteneleven=somethingwerylong
twelve=something.with.dots
答案1
sed -e :1 -e 's/^\([^=]*\)\./\1/; t1'
t1
1
如果有成功的s
命令,则分支到标签。这是在sed
.
或者:
awk -F = -v OFS== '{gsub(/\./, "", $1); print}'