I tried to get some aliases from a specific config file in a short bash script. The config looks like:
[other config]
[alias]
alias: command -o option
alias2: command -l 2
alias3: command -o option
[other config]
How would you get these aliases separated? I would prefer a output like this:
alias: command -o option
alias2: command -l 2
alias3: command -o option
I already did some bad stuff like getting line numbers and so on…
Any Ideas? Would be great!
You can do this using sed:
This will print all lines between
[alias]and the next line containing[and]that have a colon on them.