`readuntil` is your friend.

`readline` uses `readuntil`. In fact, it is defined as:

readuntil(s,'\n')

 
On Saturday, July 9, 2016 at 7:40:37 AM UTC-4, Fred wrote:
>
> Hi !
>
> It is often very useful to read a text files by blocks of lines, using 
> another line separator than '\n'.
>
> Especially in bio-informatics, for example DNA or Protein FASTA sequences 
> are separated by '\n>' (see uniprot.txt attached).
>
> In Perl,  it is possible to change the line separator using :
>  local $/ = '\n>'
> for example.
>
> In Julia I did not found how to do that :
>
> line by line :
>
> julia> f = open("uniprot.txt")
> IOStream(<file uniprot.txt>)
>
> julia> readline(f, '\n>' )
> ERROR: syntax: invalid character literal
>
>
>
>
> all lines in an array (I prefer line by line because some files do not fit 
> into RAM) :
>
> julia> readdlm("uniprot.txt", '\n>' )
> ERROR: syntax: invalid character literal
>
> readdlm("uniprot.txt", '>' ) # works but does not give the expected result
>
>
> So I suppose that this feature is currently not implemented in Julia ? 
>
> Thanks in advance for your comments !
>
>
>
>

Reply via email to