grepは「#print」の代わりに「print」を探します。

grepは「#print」の代わりに「print」を探します。

デバッグ時に「print」を多く使用し、「#print」としてコメントアウトします。 grepを使用して「印刷」の前に「#」のない行を見つけるにはどうすればよいですか?

# print <- not detect
#print <- not detect
abc # print <-- not detect
print <- detect

ベストアンサー1

grep '^[^#]*print'

print前には#以外の文字だけが来ることができます。

おすすめ記事