Text Manipulation/Replacement

D. Hugh Redelmeier hugh at mimosa.com
Fri Sep 26 05:44:22 UTC 2008


| From: Patrick O'Callaghan <pocallaghan at gmail.com>

| Splitting hairs is essential to programming. Do What I Mean hasn't been
| invented yet.

Splitting hairs: DWIM has been invented.  It was part of InterLISP
perhaps 25 years ago.

http://www.catb.org/~esr/jargon/html/D/DWIM.html
http://ars.userfriendly.org/cartoons/?id=20011121

I don't think that it lived up to its name.



Back to the original problem:

The sed script is correct but it isn't the first one that comes to my
mind since sed's hold buffer is arcane (to me).

This ed command seems easy and ought to work:
  g/^,/ .-1,.j
[Translation: for all lines that start with ",", join the previous and
current line.]

It will fail if the first line starts with ",".  This next version
would work if you are sure that the file has more than one line:
  2,$g/^,/ .-1,.j

It all depends on what tools you are used to.




More information about the fedora-list mailing list