mirror of https://github.com/tLDP/LDP
36 lines
651 B
Sed
Executable File
36 lines
651 B
Sed
Executable File
#!/bin/sed -nf
|
|
|
|
1 i \
|
|
#!/bin/sh \
|
|
# Generated by ini2sh.sed - do not modify.\
|
|
|
|
# ignore empty lines
|
|
/^[[:space:]]*$/ b
|
|
|
|
# ignore lines starting with a '#'
|
|
/^[[:space:]]*#/ b
|
|
|
|
# copy the identifier of a section header into hold space
|
|
/^[[:space:]]*\[\([[:alnum:]_]\{1,\}\)\].*/ {
|
|
s//\1/
|
|
h
|
|
b
|
|
}
|
|
|
|
# regular 'key = value' line
|
|
{ # append new-line and section name
|
|
G
|
|
|
|
# exchange section name and assignment, insert prefix
|
|
s/\(.*\)\n\(.*\)/export LAMPADAS_\2_\1/
|
|
|
|
# remove space around '=', surround value with quotes
|
|
s/[[:space:]]*=[[:space:]]\(.*\)/="\1"/
|
|
|
|
# remove all occurrences of two neighboring quotes
|
|
s/""/"/g
|
|
|
|
# give it to me, baby
|
|
p
|
|
}
|