October 7, 2003

Bulk view

NNTP access

Ani Dido Sevilla:

Apparently the only way you can have access to Usenet these days from
here is via groups.google.com. Some years ago, around 1997 or so, I
once had a Pacific Internet account and could access Usenet news via
news.pacific.net.ph, which apparently was an alias for Pacific’s Usenet
server in Singapore. Dunno if Pacific still has this service though,
but apparently the name still exists and works.

There’s more than one way to do it — linux

The original problem:


I have a file in this format of words:

joe jill bill bob frank tom harry

and want to convert the file to this format:


Is there an easy way to this? The file I have has hundreds of entries.

Several proposed solutions

for word in `cat file`; do; echo $word; done > new_file
for x in `cat file`; do echo $x; done
sed -ri 's/[ \t]+/\n/g' file
tr ' ' '\012' < infile > outfile
fmt -w 1 filename > newfile
perl -p040 -l12 -e 'chomp' filename
perl -p040 -e 's/\s/\n/' filename

John Wiegley’s ledger

From John Wiegley, Emacs ubercoder:

I’ve traded 60 Mb on my laptop for 60 Kb. How can you, too, lose
three orders of magnitude of fat and waste on your hard drive?

By checking out the incredibly lean and mean “ledger” accounting
tool. Written in C++, it parses it only, simplified general ledger
file (intended for editing with Emacs), or it can even just parse
GnuCash data files directly. This gives you the easiest way of
starting out:

ledger -f print

That will print out your GnuCash XML ledger data into much simpler,
text-based “ledger” file.

Below is the code. For reading GnuCash, you’ll need libxmltok1-dev
installed (if you’re a Debian user). It also uses GNU’s
multi-precision library (libgmp3-dev) and Perl regular expression
library (libpcre3-dev).