我正在使用leanpub.com导入我的博客,但不小心让它导入了图片。我不想这样,所以现在我想从大约2,000个单独的标记文件中删除图像。如果您熟悉降价,您就会知道图像被指定为
![optional alt text](url/link "optional title")
更新:进一步检查时,一些图片也是链接,因此它们包含如下:
[![alt text](image link "title text")](url image links to)
示例文字:
[![Hollywood: An Empire of Their Own (A&E DVD Archives)](images/51EEVBAA32L._SL160_.jpg)Hollywood: An Empire of Their Own (A&E DVD Archives)](http://www.amazon.com/Hollywood-Empire-Their-Own-Archives/dp/B0009HMTEO?SubscriptionId=08NDXT4K5C4JPKBB4702&tag=amz&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B0009HMTEO)This
"lucid, inviting work of social history" (The New York Times) highlights the
bold and enduring vision of the Jewish immigrants who founded Hollywood and reinvented American culture.
答案 0 :(得分:0)
删除令牌![
和)
之间的所有内容。请注意,可选的尾随空格很重要,因为链接可以被其他文本包围。
sed --in-place='.bak' 's/!\[.*)[[:space:]]\?//' [file ...]