Sponsored Content
Top Forums Shell Programming and Scripting Awk Script for Personal Markup Post 302583044 by uterwer on Monday 19th of December 2011 11:18:27 AM
Old 12-19-2011
Awk Script for Personal Markup

input:
Code:
----

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:
Code:
----

* 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.
 

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script for sending automatic email to personal mail id

hi guys, I need a shell script to send mail automatically to my personal mail id like xxxx@hotmail.com but while experimenting with "mail" command I faced following problems. cat text1.txt | mail -s 'test mail' xxxx@hotmail.com command successfully executed but while checking for... (4 Replies)
Discussion started by: rrd1986
4 Replies

2. Shell Programming and Scripting

Add markup tag and sequential number after specific line

Hello, This one has me a bit stumped. I have data the looks like, M END > <PREDICTION_ACCURACY> PROBABLE > <NO_OF_PARENTS> 3 > <CLOGP> -13.373 > <SMILES> OCC(O)C(OC1OC(CO)C(OC2OC(CO)C > <MIMW> 1006.322419888 (3 Replies)
Discussion started by: LMHmedchem
3 Replies
All times are GMT -4. The time now is 11:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy