Replace tab character with rake task?


#1

I’ve got a bunch of posts with lines that start with a tab character (	), and they look like this:

The first line of a paragraph 

is shown as preformatted text.

rake posts:remap["	","\ "] is not finding anything to remap. Is there a way to replace the tab character?


(Jay Pfaffman) #2

Try

rake posts:remap["\t","\ "]

#3

Are you sure, Jay?

Are you sure you want to replace all string occurrences of 't' with ' '? (Y/n)

I migh end up wi h a lo of missing ee h! :grimacing:


(Jay Pfaffman) #4

No. I’m not sure. But if that’s the message you got, you might try

rake posts:remap["\\t","\ "]

#5

I get an identical confirmation message as with a single backslash.


(Jay Pfaffman) #6

Hmm. Maybe

rake posts:remap['\t',"\ "]

#7

Still the same message…


#8

Perhaps the task needs to be told explicitly to use regex with a type argument?

Edit:

rake posts:remap["\t","\ ",regex]
Are you sure you want to replace all regex occurrences of 't' with ' '? (Y/n)

But, I am still not sure if this would remove all t characters.