0

I have a csv file with below values, I am trying to replace the value "^@" using SED command but getting error message "Pattern not found".

Value:

^@#uiuiuiui^@
^@#uiuiuiui^@
^@#uiuiuiui^@
^@#uiuiuiui^@
^@#uiuiuiui^@

Attempt:

sed 's/^@/$/g' file.csv

1 Answer 1

1

You have to backslash the ^ char. In a regular expression, it means "starts with". It is an operator. Since you want to explicitly replace it, backslash it.

So:

sed 's/\^@/$/g' file.csv
Sign up to request clarification or add additional context in comments.

3 Comments

I tried the option but still it is not replacing the value. The same error mgs "Pattern not found" is displayed.
I put your sample content in a file and ran it, it works. Make sure your file has unix line feeds (dos2unix file.csv).
I am trying it in Mac.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.