Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SED help -

7 views
Skip to first unread message

vjp...@at.biostrategist.dot.dot.com

unread,
Sep 25, 2009, 3:09:38 PM9/25/09
to
I have a file that has a series of lists

(qqq)
aaa 111
bbb 222

and I want to make it look like

aaa 111 (qqq)
bbb 222 (qqq)

where some lists have only aaa
and some have both or more but all end in a number

the list should be considered ended if another (qqq) shows up

My algorithm might be:
Find line with first non-blank character is paren
cut that lineinto buffer
go to end of subsequnt lines ending in number
insert the paren's field after the number
repat for contiguous line (between one and four)
if you run into a blank line or parent's field, stop and start over

- = -
Vasos Panagiotopoulos, Columbia'81+, Reagan, Mozart, Pindus, BioStrategist
http://www.panix.com/~vjp2/vasos.htm http://www.facebook.com/vasjpan2
---{Nothing herein constitutes advice. Everything fully disclaimed.}---
[Homeland Security means private firearms not lazy obstructive guards]
[Urb sprawl confounds terror] [Phooey on GUI: Windows for subprime Bimbos]

Mark Blain

unread,
Sep 25, 2009, 9:41:50 PM9/25/09
to
vjp...@at.BioStrategist.dot.dot.com wrote in
news:h9j4hi$aic$1...@reader1.panix.com:

> I have a file that has a series of lists
>
> (qqq)
> aaa 111
> bbb 222
>
> and I want to make it look like
>
> aaa 111 (qqq)
> bbb 222 (qqq)
>
> where some lists have only aaa
> and some have both or more but all end in a number
>
> the list should be considered ended if another (qqq) shows up
>
> My algorithm might be:
> Find line with first non-blank character is paren
> cut that lineinto buffer
> go to end of subsequnt lines ending in number
> insert the paren's field after the number
> repat for contiguous line (between one and four)
> if you run into a blank line or parent's field, stop and start over

If you do not receive an answer here, try asking in
<news:gnu.utils.help>
or
<news:comp.unix.shell>

0 new messages