Case-insensitive search and replace with sed

前端 未结 8 1908
暗喜
暗喜 2020-11-28 08:51

I\'m trying to use SED to extract text from a log file. I can do a search-and-replace without too much trouble:

sed \'s/foo/bar/\' mylog.txt
<
8条回答
  •  Happy的楠姐
    2020-11-28 09:44

    The Mac version of sed seems a bit limited. One way to work around this is to use a linux container (via Docker) which has a useable version of sed:

    cat your_file.txt | docker run -i busybox /bin/sed -r 's/[0-9]{4}/****/Ig'
    

提交回复
热议问题