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
- Host: GitHub
- URL: https://github.com/fps/unnest
- Owner: fps
- Created: 2010-03-28T12:41:58.000Z (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2010-03-28T12:58:13.000Z (almost 16 years ago)
- Last Synced: 2023-03-11T07:42:21.195Z (almost 3 years ago)
- Homepage:
- Size: 89.8 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
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)