FOERBICO/sb/scripts/replace-absolute-path-by-relative.sh

14 lines
533 B
Bash
Executable file

#!/bin/bash
SCRIPT_TMP_DIR='.tmp-3misn'
mkdir -p $SCRIPT_TMP_DIR
sed 's#http.*://oer.community/wp-content/uploads/.*/##g' $1 > $SCRIPT_TMP_DIR/out1
sed 's#http.*://pad..*/upload.*/##g' $SCRIPT_TMP_DIR/out1 > $SCRIPT_TMP_DIR/out2
cat $SCRIPT_TMP_DIR/out2
rm -rf $SCRIPT_TMP_DIR
# Aufruf z. B. durch `$ sb/scripts/replace-absolute-path-by-relative.sh sb/content/hello-world/index.md`
# $ cd sb/content/
# $ replace.sh $blogpost-folder/index.md > $blogpost-folder/rel-index.md
# $ mv index.md abs-index.md && mv rel-index.md index.md