Created
December 4, 2008 19:04
-
-
Save ravicious/32024 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
By Ravicious aka Torian (ID 386) | |
http://ravsite.net/ | |
Umieść swój ASCII art w pliku "ascii.txt" w tym samym folderze, co skrypt. Następnie odpal skrypt i otwórz ponownie plik, a później możesz to wkleić do swojego profilu ;) | |
Thanks for: | |
- Robert Evans | |
http://www.megasolutions.net/ruby/search-a-file-and-replace-text-50116.aspx | |
- Hipekhop | |
http://orodlin.webhost.pl/forum/index.php?topic=1169.msg16585#msg16585 | |
=end | |
def ChangeOnFile(file, regex_to_find, text_to_put_in_place) | |
text = File.read file | |
File.open(file, 'w+'){|f| f << text.gsub(regex_to_find, text_to_put_in_place)} | |
end | |
ChangeOnFile('ascii.txt', / /, "[color=#000000]- [/color]") | |
ChangeOnFile('ascii.txt', /\[\/color\]\[color=#000000\]/, "") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment