Awk Script for Personal Markup

input:

----

blablablabla foofoofooo

nothing foo never never
nothing foo ever forever

	foo bar foo
	moo bar moo

	status quo

blablabla never foo

	moo bar moo

blablabla pehh

----

desired ouput:

----

* blablablabla foofoofooo

*<2-n> nothing foo never never
*<2-n> nothing foo ever forever

<[cd]
	[<3-n>foo bar foo]
	[<3-n>moo bar moo]
[cd]>

<[cd]
	[<4-n>status quo]
[cd]>

*<5-n> blablabla never foo

<[cd]
	[<6-n>moo bar moo]
[cd]>

*<n> blablabla pehh

----
  • n is number of records seperated with one or more blank lines

  • dashes are delimiter pattern for counting records

  • [cd] tagged records identified by tab indentation

  • what i can't handle is to assign record count properly to a awk variable ?

thx for help.

How are you trying to use it? You should be able to get the record number directly from NR (or FNR).

hi ; use NR but can't manipulate nested code (conditional loop) for (pattern matching + variable assignment).

awk only used for simple operations before.