First I tried grep
ping the file using the matching only option and adjust from there;
# REGEX
function () { # ((\w|ç|Ç|ñ|Ñ)+\s+\(\)\s+\{\n)
blahblah # (.*\n)+
} # (\})
…it worked except it was one giant match. Then I remembered about declare -f
but it was sort of the same situation. I thought I could use some loop and redirect the output to files slapping a #!…
on top, have a drink. Not quite; I overlooked that I'd need to break it apart first in order to loop the pieces and then >
into files.
What I think I could do is work with the output of declare -F
then use the array it outputs to declare -f
/for entry in "${array[@]}"
. I think I might be over-complicating though, so I'd like to know how actual developers would do this.
Any advice you'd like to offer?
Thanks in adv. <3