Useful grep – sed -xargs Commands

git add All Markdown Images

Here’s a one-liner you can run on a Markdown file and have all of the references images added to git. (Yes, I know git isn’t great for binary files, but still useful.)

grep "\!\[\(\)\]" README.md | sed 's/.*(\(.*\))/\1/' | xargs git add

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.