How to remove a string from file in mac terminal
I have a file with million records and each line ends with SYSTEM;\N. I want to delete all occurrences of ;\N from file.
You can use the sed command to replace all the occurrences of the ';\N' from the file and replace it with ''.
sed -i 's/original/new/g' file.txt
sed = Stream EDitor
-i = in-place (i.e. save back to the original file)
The command string: s = the substitute command
original = a regular expression describing the word to replace (or just the word itself)
new = the text to replace it with
g = global (i.e. replace all and not just the first occurrence)
file.txt = the file name
This worked finally
sed -i '' 's/;\\N//g' test112.csv