[Solved] What does this sed command do? [closed]


That’s not a sed script, it’s a shell script containing bash, sed, and cut commands. The sed script is obfuscated by bad quoting practices, unnecessarily changing the delimiter, and adding an unnecessary argument. I assume you know what cut -f 2 does so I can’t imagine why you included that to further obfuscate your question and so I’m going to ignore it and focus on the sed part.

The command you have is:

sed -E $'s:$:\t:'

Let’s rewrite that sensibly and you get:

sed 's/$/'$'\t'"https://stackoverflow.com/"

which without the ' script delimiters and with some extra white space added for clarity is:

s/  $  /  $'\t' /

Now do you see what it’s doing? Replacing the end-of-line with a tab.

1

solved What does this sed command do? [closed]