challenge 条件を満たす行を取り除く

ファイルから1行ずつ読み込み、"#"で始まる行だけを取り除いてファイルに出力するコードを書いてください。

サンプル入力

hello!
# remove this
 # don't remove this
bye!
サンプル出力
hello!
 # don't remove this
bye!

Posted feedbacks - sed

grep はないの?
grep -v '^#' のほうが美しいと思うけど。 
1
sed '/^#/d' file >file2

Index

Feed

Other

Link

Pathtraq

loading...