redo_headers.sh

Created by Xinxiang Wang, Modified on Fri, 15 Dec, 2023 at 8:28 AM by Xinxiang Wang

#!/bin/bash
for file in $(find . -maxdepth 1 -type f -name '*.md' ! -name 'UserGuide.md' ! -name 'index.md'); do
    # Process each line in the file
    while read -r line; do
        if [[ $line == \** ]]; then
            line=$(echo "$line" | sed -e 's/^\*//' -e 's/\*$//')
            line="# $line"
        fi
        echo "$line" >> tmp.md
    done < "$file"
    # Move the temporary file back to the original file
    mv tmp.md "$file"
done

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article