i searched long for this but i could not figure out what this sed actually does!?
sed -E $'s:$:\t:' < file1 | cut -f 2 > file2
Who can explain me please?
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''/'
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.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments