Skip to content

Instantly share code, notes, and snippets.

@Loveforkeeps
Created October 18, 2017 07:43
Show Gist options
  • Save Loveforkeeps/95560ba52f71112c04b6f7e0893f5c74 to your computer and use it in GitHub Desktop.
Save Loveforkeeps/95560ba52f71112c04b6f7e0893f5c74 to your computer and use it in GitHub Desktop.
MD文档格式更正,###后无空格则添加空格
#!/bin/bash
for index in `cat -n $1 | grep -vE '#+\s'| grep -E '#+' | awk '{print $1}'`;
do
echo "第"$index"行";
arg="sed -i '.bak' '${index}s/\#\{1,\}/& /g' $1"
echo $arg | sh
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment