Hello Programmers, In this post, you will know how to solve the ‘Sed’ command #4 HackerRank Solution. This problem is a part of the HackerRank Linux Shell Series.‘Sed’ command #4 HackerRank SolutionOne more thing to add, don’t directly look for the solutions, first try to solve the problems of Hackerrank by yourself. If you find any difficulty after trying several times, then you can look for solutions.‘Sed’ command #4 HackerRank SolutionObjectiveSed is a popular utility that enables quick parsing and transformation of text. Here are some basic uses for it:Substitute the first occurrence of editor with tool:$:~/hackerrank/bash/grep/grep1$ echo "My favorite programming editor is Emacs. Another editor I like is Vim." | sed -e s/editor/tool/ My favorite programming tool is Emacs. Another editor I like is Vim. Substitute all occurrences of editor with tool:$:~/hackerrank/bash/grep/grep1$ echo "My favorite programming editor is Emacs. Another editor I like is Vim." | sed -e s/editor/tool/g My favorite programming tool is Emacs. Another tool I like is Vim. Substitute the second occurrence of editor with tool:$:~/hackerrank/bash/grep/grep1$ echo "My favorite programming editor is Emacs. Another editor I like is Vim." | sed -e s/editor/tool/2 My favorite programming editor is Emacs. Another tool I like is Vim. Highlight all occurrences of editor by enclosing them in curly brackets (i.e., {}):$:~/hackerrank/bash/grep/grep1$ echo "My favorite programming editor is Emacs. Another editor I like is Vim." | sed -e s/editor/{\&}/g My favorite programming {editor} is Emacs. Another {editor} I like is Vim. TaskGiven lines of credit card numbers, mask the first digits of each credit card number with an asterisk (i.e., *) and print the masked card number on a new line. Each credit card number consists of four space-separated groups of four digits. For example, the credit card number 1234 5678 9101 1234 would be masked and printed as **** **** **** 1234.Input FormatEach line contains a credit card number in the form dddd dddd dddd dddd, where d denotes a decimal digit (i.e., 0 through 9). There are a total of n lines of credit card numbers.Constraints1 <= n <= 20; note that the value of n does not matter when writing your command.Output FormatFor each credit card number, print its masked version on a new line.Sample Input1234 5678 9101 12342999 5178 9101 22349999 5628 9201 12328888 3678 9101 1232Sample Output**** **** **** 1234**** **** **** 2234**** **** **** 1232**** **** **** 1232ExplanationObserve that the first twelve digits have been masked for each credit card number, and they are printed in the same order as they were received as input.‘Sed’ command #4 HackerRank Solutionssed -r 's/[0-9]{4}[ ]/**** /g'Note: This problem (‘Sed’ command #4) is generated by HackerRank but the Solution is Provided by BrokenProgrammers. This tutorial is only for Educational and Learning purposes.Next: ‘Awk’ – 2 HackerRank Solution Post navigation‘Sed’ command #3 HackerRank Solution ‘Awk’ – 2 HackerRank Solution