[mdlug] Need help with bash array usage

Jeff Hanson jhansonxi at gmail.com
Wed Jul 9 18:44:32 EDT 2008


On Tue, Jul 8, 2008 at 11:57 PM, Robert Citek <robert.citek at gmail.com> wrote:
> But then maybe you don't even need arrays:
>
> $ find . -type f -iname "*.txt" -print0 |
> xargs -0 grep -l "MATCH" |
> awk '{print NR ": " $0 }'

I though about trying awk but I'd have to learn the language.  I
learned a little bit about it ten years ago when trying to fix a CAD
utility that used it.  I see it has it's own array variables which may
be useful.  But testing your suggestion showed that bash still loads
the output into an array as a list with element values delimited by
spaces.  Might be useful if nothing else works but it would require
restructuring the script I'm working on.



More information about the mdlug mailing list