Thiago Lewin wrote in post #986702:
> Hi Joyce,
>
>   # First you should read the file:
>   alunos = IO.readlines('alunos.txt') # return an array with all ids
>
>   # Remove the selected id:
>   alunos.delete_if do |linha|
>     dados = linha.split(":") #"quebra" quando encontrar dois pontos
>     outrosDados = dados[0].split("!")
>
>     outrosDados == login
>   end
>
>   # Open the file and rewrite the content

>
>   This should work!

...unless your computer crashes right after you open the file.   To 
guard against losing all your data, you have to use a temporary file 
as--unkown posted.  The Tempfile module is helpful in that regard.

-- 
Posted via http://www.ruby-forum.com/.