Unsure of sed notation (nu\\t.\*)

This piece of code is in a shell script I'm trying to modify to run on my system.

sed s:nu\\t.\*:"nu=0"

It's clearly a substitute script which replaces nu\\t.\* with nu = 0.

What exactly does

nu\\t.\*

demarcate though-- I thought it was just the previous nu = xxxxx (which existed and is getting overwritten) but the double forward slashes and then the t confuse me.

Thanks in advance.

A backslash (\) is an way to force the interpretation of the next character the way it is.

Yes, I know. So why the double backlash? Is that to force the interpretation of the 2nd one as a backslash?

Then it would mean that

nu\\t.\*

is replacing

nu\t.* 

Which doesn't make sense in the context of the file.

You must have garbled the code while posting. That's not a valid sed command since the substitute command is unterminated.

If we add a : at the end, then at least we have something that makes sense to at least one sed implementation, GNU sed. Even so, I'm inclined to believe that whoever wrote that is deranged and/or trying to intentionally confuse the reader.

If single quotes were used to protect the sed script, all but one of the backslashes and all of the double quotes would not be needed. There's also no need to use the non-default delimiter (colon) since there are no forward slashes in the command. A much clearer version:

sed 's/nu\t.*/nu=0/'

What does that mean then? \t is an undefined sequence in POSIX sed. GNU sed treats it as an extension which matches a tab character. So, assuming GNU sed, it replaces nu<tab><optional misc characters><end of line> with nu=0<end of line>.

Regards,
Alister