Reputation: 7013
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.
Upvotes: 5
Views: 9818
Reputation: 1223
I think ABCD's answer will work. But if it doesn't work, try the following:
tr -d "`echo -e '\013'`" < memo.txt > memo.new
The embedded echo command will output the actual ^K character, so tr will know exactly what to delete.
Upvotes: 0
Reputation: 11571
You might want to try something like this:
tr -d '\013' < memo.txt > memo.new
013
is the octal value for the character ^K
.
Upvotes: 5