Raveen Kumar

Sed

To replace text

sed 's/text/replacement_text/g' <file_name>

To replace text and write file

sed -i 's/text/replacement_text/g' <file_name> ** Append to beginning of a file sed -i ‘1i text’ file.txt * back

Find and replace a specific line from all files in current directory matching a specific extension

Here, all .md files have

<a id="org55550fd"></a>

Line in it. The following command deletes those lines from all the files.

find . -iname "*.md" -exec sed -i '/<a id=*/d' {} \;    

#Sed #Linux #Command-Line