# Removing/Replacing Tabs to Spaces -- Global Find and Replace

**URL:** <https://www.ruby-forum.com/t/removing-replacing-tabs-to-spaces-global-find-and-replace/73703>\
**Category:** Rails\
**Created:** [October 26, 2006, 1:49pm UTC](https://www.ruby-forum.com/t/removing-replacing-tabs-to-spaces-global-find-and-replace/73703 "2006-10-26T13:49:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![walksalong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/4491bb/32.png) [@walksalong](https://www.ruby-forum.com/u/walksalong)\
**Post date:** [October 26, 2006, 1:49pm UTC](https://www.ruby-forum.com/t/removing-replacing-tabs-to-spaces-global-find-and-replace/73703/1 "2006-10-26T13:49:52Z")

</div>

Are there any editors out there that will do a global site find and  
replace to change tabs to spaces? I am trying to run a larger existing  
Ruby site that was developed on macs to windows and I’m having some  
problems and I imagine it is because of the existence of tabs.

Thanks

---

<div class="post-metadata">

**Author:** ![walksalong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/4491bb/32.png) [@walksalong](https://www.ruby-forum.com/u/walksalong)\
**Post date:** [October 26, 2006, 2:41pm UTC](https://www.ruby-forum.com/t/removing-replacing-tabs-to-spaces-global-find-and-replace/73703/2 "2006-10-26T14:41:54Z")

</div>

Hello,

> Are there any editors out there that will do a global site  
> find and replace to change tabs to spaces? I am trying  
> to run a larger existing Ruby site that was developed on  
> macs to windows and I’m having some problems and I  
> imagine it is because of the existence of tabs.

Well, Ruby can do that :

$ ruby -pe ‘gsub(/\t/, " ")’ \< old\_file.rb \> new\_file.rb

assuming you want two spaces for one tab.

```
 -- Jean-FranÃ§ois.

```

–  
Ã? la renverse.

---

<div class="post-metadata">

**Author:** ![walksalong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/4491bb/32.png) [@walksalong](https://www.ruby-forum.com/u/walksalong)\
**Post date:** [October 27, 2006, 12:33pm UTC](https://www.ruby-forum.com/t/removing-replacing-tabs-to-spaces-global-find-and-replace/73703/3 "2006-10-27T12:33:23Z")

</div>

jEdit will search and replace through a whole directory.

Also, I have moved my rails site from a PC to a Mac and never had any  
issues with tabs or spaces.
