user16308738
user16308738

Reputation: 17

Unable to replace a pattern in csv file using unix command

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

Upvotes: 0

Views: 41

Answers (1)

Nic3500
Nic3500

Reputation: 8611

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

Upvotes: 1

Related Questions