我有一些配置文件,每个文件都有数百行数据。
我想以井号('#')开始每一行(在回车之后),除非它已经以井号开头。我不想进行查找+替换,因为我有文件的其他注释部分不是行的开头。
例如,这个:
Some data #some comment
Some more data #some other comment
Even more data
#some line comment
会变成:
#Some data #some comment
#Some more data #some other comment
#Even more data
#some line comment