Last active
January 29, 2023 19:29
-
-
Save CharlesSchimmel/0d969972b000e82c5d001794745ce290 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