An open API service indexing awesome lists of open source software.

https://github.com/fps/unnest

A simple python tool to replace brackets with patterns indicating the nesting depth
https://github.com/fps/unnest

Last synced: 3 days ago
JSON representation

A simple python tool to replace brackets with patterns indicating the nesting depth

Awesome Lists containing this project

README

          

- A simple tool to do something with nested brackets in text files :D

- Requirements:

Python

- Installation:

copy the unnest script to somewhere in your path

- Usage examples

unnest -s "`cat test.txt`" -r "[\$level\1]"

this transforms this (test.txt):

---- cut here

bla (
blub (

)
blablub (
foo (
)
)
)

blubber

---- end cut here

into this":

---- cut here

bla [1(]
blub [2(]

[2)]
blablub [2(]
foo [3(]
[3)]
[2)]
[1)]

blubber

---- end cut here

The previous example used the default regexp for opening and
closing brackets.. Here's an example with curly brackets:

unnest -s "`cat test2.txt`" -r "[\$level\1]" -o '{' -c '}'

this transforms this (test2.txt):

---- cut here

bla {
blub {

}
blablub {
foo {
}
}
}

blubber

---- end cut here

into this:

---- cut here

bla [1{]
blub [2{]

[2}]
blablub [2{]
foo [3{]
[3}]
[2}]
[1}]

blubber

---- end cut here

- Author:

Florian Paul Schmidt (mista.tapas@gmx.net)