[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Text Manipulation/Replacement

| From: Patrick O'Callaghan <pocallaghan 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.


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.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]