部分中的行的腳本我正在尋找想法讓腳本執行以下操作:用於計算不包括#
我有一個文本文件,例如: test.txt
與它相似文本:
#
# sectione 1
#
several
text
lines
and so on
#
# sectione 2
#
more text
and more
#
and more
# ...
#
# sectione 3
#
more
more
more
#
# sectione 4
#
...
...
我需要一種可能性,只計算在sectione 2線和排除開頭的行#
在我上面的例子中的腳本應該顯示我「反3「在末尾 例如。
# counter_script.sh test.txt
# 3
這是可能性,我該怎麼辦? 我使用Debian Linux和bash shell。