0
結束我有一個包含文件的多個類似區段SED範圍起始於匹配後線和第二匹配
...
# PostgreSQL configuration example
#production:
# adapter: postgresql
# database: redmine
# host: localhost
# username: postgres
# password: "postgres"
# SQLite3 configuration example
#production:
# adapter: sqlite3
# database: db/redmine.sqlite3
# SQL Server configuration example
#production:
# adapter: sqlserver
# database: redmine
# host: localhost
# username: jenkins
# password: jenkins
...
我要評論/ decomment的整個部分。
隨着 「sqlite3的」 我想有以下輸出:
...
# PostgreSQL configuration example
#production:
# adapter: postgresql
# database: redmine
# host: localhost
# username: postgres
# password: "postgres"
# SQLite3 configuration example
production:
adapter: sqlite3
database: db/redmine.sqlite3
# SQL Server configuration example
#production:
# adapter: sqlserver
# database: redmine
# host: localhost
# username: jenkins
# password: jenkins
...
我想是這樣的:
sed -i -e '/SQLite3/+1,/^\s*$/ s/^#//' FILE
...但它不工作,因爲 '+1'無效。
如何在比賽結束後在線上開始一個範圍? (我嘗試了幾個帶有大括號和'n'的變體,但我沒有找到正確的拼寫)
請添加所需的輸出爲輸入您的問題樣本。 – Cyrus
[如何選擇兩個模式之間的線?](https://stackoverflow.com/questions/38972736/how-to-select-lines-between-two-patterns)可能的重複... ...修改此形式'sed - n'/ PAT1 /,/ PAT2/{/ PAT1 /!p}'文件' – Sundeep
@Cyrus:已更新。 – ZioByte