问题描述
我在git Wiki上有markdown(md)文件,我正在将其更改为html.我不想在html文件中包含图像和链接.我们在markdown中的图片如下所示:
I have markdown (md) files, on a git wiki, that I am changing to html. I don't want to include the images and links in the html file. Our images in markdown looks like this:

我们的降价链接如下:
[I'm an inline-style link](https://www.google.com)
唯一的不同是!"特点.我正在编写一个shell脚本来做所有事情.什么是bash命令删除整个图像和链接标签?这是一个更基本的sed堆栈问题:
The only real different is the '!' character. I am writing a shell script to do everything. What is a bash command(s) to remove the entire image and link tag? Here is a more basic sed stack question:
How to remove square brackets and any text inside?
ps. can you include a smile in your answer? I am tired and want to go home.
推荐答案
$ sed 's/\!\{0,1\}\[[^]]*\]([^)]*)//g' file.md
This works too but... see potong's comment here below:
$ sed 's/!\?\[.*\](.*)//g' file.md
这篇关于使用bash(最好是sed)命令删除markdown(md)文件中的图像和链接标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!