sed + remove “#” and empty lines with one sed command

后端 未结 7 2115
旧巷少年郎
旧巷少年郎 2020-12-08 02:57

how to remove comment lines (as # bal bla ) and empty lines (lines without charecters) from file with one sed command?

THX lidia

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-08 03:53

    you can use awk

    awk 'NF{gsub(/^[ \t]*#/,"");print}' file
    

提交回复
热议问题