我面临一个包含多个像这样的 bibtex 实例的文本文件
@article{Lindgren1989Resonant,
abstract = {Using a simple model potential, a truncated image barrier, for the
Al(111) surface, one obtains a resonant bound surface state at an energy
that agrees surprisingly well with recent observations by inverse
photoemission.},
author = {Lindgren and Walld\'{e}n, L.},
citeulike-article-id = {9286612},
citeulike-linkout-0 = {http://dx.doi.org/10.1103/PhysRevB.40.11546},
citeulike-linkout-1 = {http://adsabs.harvard.edu/cgi-bin/nph-bib\_query?bibcode=1989PhRvB..4011546L},
doi = {10.1103/PhysRevB.40.11546},
journal = {Phys. Rev. B},
keywords = {image-potential, surface-states},
month = dec,
pages = {11546--11548},
posted-at = {2011-05-12 11:42:49},
priority = {0},
title = {Resonant bound states for simple metal surfaces},
url = {http://dx.doi.org/10.1103/PhysRevB.40.11546},
volume = {40},
year = {1989}
}
我想擦除抽象字段,它可以跨越一个或多个(如上述情况)行。我尝试以以下方式使用 sed
sed "/^\s*${field}.*=/,/},?$/{
d
}" file
其中 file 是包含上述 bibtex 代码的文本文件。但是,这个命令的输出只是
@article{Lindgren1989Resonant,
显然 sed 与最后的 } 匹配,但我如何让它匹配抽象值的右括号?