In a markdown file, the level of heading is decided by the number of # at the beginning of the line. For example, # at the beginning of the line indicates a level 1 heading, ## indicates a level 2 heading and so on. There is a space between # and heading text. The sample input shown below conveys the simplicity of the test cases.
Write a SED script 'script.sed'
# to ## and ## to ###Sample Input
# Line Editors
## Ed
---
# Modal Editors
## Vi
## Vim
## Neovim
---
# Non-modal Editors
## Nano
## Emacs
Sample Output
# Text editors in Linux
## Line Editors
### Ed
---
## Modal Editors
### Vi
### Vim
### Neovim
---
## Non-modal Editors
### Nano
### Emacs
In a markdown file, the level of heading is decided by the number of `#` at the beginning of the line. For example, `#` at the beginning of the line indicates a level 1 heading, `##` indicates a level 2 heading and so on. There is a space between `#` and heading text. The sample input shown below conveys the simplicity of the test cases. Write a SED script 'script.sed' - To reduce the level of heading by 1, for example `#` to `##` and `##` to `###` - Add "# Text editors in Linux" as the first line **Sample Input** ```text # Line Editors ## Ed --- # Modal Editors ## Vi ## Vim ## Neovim --- # Non-modal Editors ## Nano ## Emacs ``` **Sample Output** ```text # Text editors in Linux ## Line Editors ### Ed --- ## Modal Editors ### Vi ### Vim ### Neovim --- ## Non-modal Editors ### Nano ### Emacs ``` A student named Pankaj found the output of the `diff` command confusing. He found two lines that looked the same but were marked as different. He presumed that it could be due to the presence of tab spaces present in the file. He wants to see the line end and tab characters. He decided to replace the tab spaces with "^I" and mark the end of the line with "$" in the files. Write a **sed script** 'script.sed' to visualize the line end and tab characters by replacing them with `$` and `^I`, respectively. **Example:** ```bash $ cat file_a abcd efgh $ cat file_b efgh ijkl $ diff -u file_a file_b --- file_a 2023-11-27 14:29:47.230882094 +0530 +++ file_b 2023-11-27 14:29:53.640882534 +0530 @@ -1,3 +1,3 @@ abcd -efgh +efgh ijkl $ diff -u file_a file_b | ./script.sed --- file_a^I2023-11-27 14:29:47.230882094 +0530$ +++ file_b^I2023-11-27 14:29:53.640882534 +0530$ @@ -1,3 +1,3 @@$ abcd$ -efgh$ +efgh $ ijkl$ ``` Programmers are used to tag comments in the code with TODO, REVIEW, NOTE, HACK, FIXME, and DEPRECATED keywords. Write an **AWK script** 'script.awk' to find all the occurrences in files and print only the filename and line number in the format `<filename>:<line number>`.