如何使用bash脚本(sed、awk..等)取消注释hocon文件中包含特定文本的特定行

如何使用bash脚本(sed、awk..等)取消注释hocon文件中包含特定文本的特定行,sed,Sed,我有一个hocon文件,其中包含以下文本,我想取消注释其中包含CPU的行 // Size of buffer for events waiting to be processed by the fetcher. Typically, this should // be at least 3-4x number of cores to ensure that the processing pipeline is making use of //

我有一个hocon文件,其中包含以下文本,我想取消注释其中包含CPU的行

   // Size of buffer for events waiting to be processed by the fetcher. Typically, this should       
    // be at least 3-4x  number of cores to ensure that the processing pipeline is making use of       
    // all available CPUs and it is always running       maxFetcherBufferSize: 100
你可以这样做

sed -r '/CPU/{s/[^//]*\/\/\b*(.*)/\1/}' filename
如果要在位编辑文件,请使用-i选项


是否要取消对文本“所有可用CPU…”的注释,还是要生成一个带有文本“maxFetcherBufferSize:100”的未注释行?