Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove special characters from a file in linux

Tags:

linux

I am trying to remove a bunch of ^K from a file in linux for class but everything I have been trying is not working.

so I cat a file memo.txt and it has double spaced lines

I less the file and it has ^K after every line

I am trying to remove the ^K and output it into a new file

I have tried

cat memo.txt | tr -d "\n" > memo.new
cat memo.txt | tr -d "^K" > memo.new

and some other sed functions.

like image 377
BillPull Avatar asked Oct 05 '11 19:10

BillPull


1 Answers

You might want to try something like this:

tr -d '\013' < memo.txt > memo.new

013 is the octal value for the character ^K.

like image 191
Jonathan Callen Avatar answered Sep 27 '22 17:09

Jonathan Callen