私はファイルを持っています:
@Book{gjn2011ske,
author = {Grzegorz J. Nalepa},
title = {Semantic Knowledge Engineering. A Rule-Based Approach},
publisher = {Wydawnictwa AGH},
year = 2011,
address = {Krak\'ow}
}
@article{gjn2010jucs,
Author = {Grzegorz J. Nalepa},
Journal = {Journal of Universal Computer Science},
Number = 7,
Pages = {1006-1023},
Title = {Collective Knowledge Engineering with Semantic Wikis},
Volume = 16,
Year = 2010
}
1行目だけ削除した正規表現を改善したい。注:レコード セパレータRS="}\n"
は変更できません。
私は試した:
awk 'BEGIN{ RS="}\n" } {gsub(/@.*,/,"") ; print }' file
結果を印刷したい:
author = {Grzegorz J. Nalepa},
title = {Semantic Knowledge Engineering. A Rule-Based Approach},
publisher = {Wydawnictwa AGH},
year = 2011,
address = {Krak\'ow}
Author = {Grzegorz J. Nalepa},
Journal = {Journal of Universal Computer Science},
Number = 7,
Pages = {1006-1023},
Title = {Collective Knowledge Engineering with Semantic Wikis},
Volume = 16,
Year = 2010
ご協力ありがとうございました。
編集:
私の提案した解決策:
awk 'BEGIN{ RS="}\n" }{sub(",","@"); sub(/@.*@/,""); print }' file