Forked from CharlesSchimmel/wikilinks-to-markdown-links.sh
Created
January 29, 2023 19:29
-
-
Save charudatta10/a9b84df5dffaafe9a6e38834e170c4e5 to your computer and use it in GitHub Desktop.
Convert WikiLinks to Markdown Links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
:' | |
Matching: | |
\[\[ inside of double bracket literals | |
( capture... | |
[^ all characters that are not.. | |
\[\| left bracket or pipe literal | |
] | |
+ one or more times | |
) | |
\| followed by a pipe literal | |
( capture... | |
[^ all characters that are not... | |
\[ left bracket literal | |
] | |
+ one or more times | |
) | |
\]\] | |
Second one is the same but without the description | |
' | |
sed -r -i 's,\[\[([^\[\|]+)\|([^\[]+)\]\],[\2](\1),g' $@ | |
sed -r -i 's,\[\[([^\[\|]+)\]\],[\1](\1),g' $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment