Artificial intelligent assistant

sed command that replaces number and word by two 1) sed command which puts two of the first 'w' on each line. E.g "hewor" = "hewwor". and 2) sed command which puts two of the first digit on each line E.g "hew0r" = "hew00r" For first one I got $ sed s/w/ww/ for the second one I don't understand how to replicate the same digit for example I got $ sed s/[0-9]/00/ would work but it would have to be zero each time. How do I get the same digit?

You need to use the `sed`'s feature, called groups (may be not the best reference, try to search for other tutorials). In you case the solution is


sed 's/\([0-9]\)/\1\1/' input_file.txt


the regexp for the first group `\([0-9]\)` will match any digit, and the part `\1\1` says to replace the first group with itself repeated twice.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 627a2d73099405708a97283b3d9a3589