Linux: cr/lf strikes again

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Linux: cr/lf strikes again

Schwab,Wilhelm K
Hello all,

The problem: I am using an understandably (to a point) clunky web
interface to grab full-text articles.  I remember the days of going to
the library to pull this stuff, so I try to keep it in perspective.

Most of the files have names that are not at all helpful; sdarticle.pdf
is common.  So, I save the file with a name that means something to me
(author - topic.pdf) in a subject-specific directory.  Google scholar
offers the next blessing: BibTeX entries.  More clicking and copying,
but **well** worth it.  It is really nice to have the BibTeX entry
include the file name; it's a pain to do editing :(

I was doing this for a while, and realized that if I taught the machine
to find the most recent file under the pdf path, and had it pull the
BibTeX entry from the clipboard, it could save me a LOT of hassle.

Ordinarily, I would do this in Dolphin, but I "need" to do this on
Linux, so Squeak got the nod.  It almost works.  I can open the existing
.bib file, finding the new full-text file and therefore its name was
easy, and copying the BibTeX entry from the clipboard works.  It asserts
just enough to prevent ugly mistakes.  It then hacks the entry to list
the file in an ignored field, and replaces all the text, plus the new
entry (suggestions for appending and scrolling to the end would be most
welcome), in a pluggable text morph.  It's shameful all around, but it
works.

The next task is to save the result.  FileStream will do it, but before
that, I just selected and copied/pasted the text into gedit, only to
find lots of extraneous new lines even though those are not visible in
the text morph.  What should I do?  Stream over lines in the text and
write them to the file?  Something #nextLineLf and then peek for the
cr???  I will share the results with windows for a good while to come.
Would I then want to write in binary mode and use lf/cr pairs so that
even the lowly notepad will get the idea about the lines?

Bill



Wilhelm K. Schwab, Ph.D.
University of Florida
Department of Anesthesiology
PO Box 100254
Gainesville, FL 32610-0254

Email: [hidden email]
Tel: (352) 846-1285
FAX: (352) 392-7029