[seqfan] Re: OEIS, unwanted line breaks in internal format
Richard Mathar
mathar at strw.leidenuniv.nl
Fri Sep 3 19:33:46 CEST 2010
http://list.seqfan.eu/pipermail/seqfan/2010-September/005911.html
The quickest way to recover the internal format from the web interface
seems to be
1) Download the page with the sequence in the "txt"
format option (right from the "long","short","internal" in the yellow
header line) to some ASCII file.
2) Pipe the ASCII file through a perl program like this one, which
attaches lines to previous ones if they start with 15 blanks (as proposed):
#!/usr/bin/locate perl
# standard input is http://oeis.org/classic/?q=id....fmt=3
# created by downloading an OEIS file in "txt" format
$h = ""; # hold space
while(<>)
{
# Line starts with 15 blanks: that's a followup wrap-around
if ( $_ =~ m"^ " )
{
chomp($h) ; # remove previous line feed
$h = $h.substr($_,15) ; # attach current line without leading blanks
}
elsif ( $_ =~ m"%" ) # if a true line that starts with percent...
{
print $h ;
$h = $_ ;
}
# if something else (like the "last modified" etc); do nothing
}
More information about the SeqFan
mailing list