Re: how to combine two lists without join?
Gaudenz Steinlin wrote:
>
> To integrate discover2 into hw-detect I need to combine to lists into
> one without join (which is not available in busybox and not on d-i
> images):
>
> MODEL_INFOS=$(discover -t all)
> MODULES=$(discover --data-path=linux/module/name all)
>
> MODEL_INFOS and MODULES now contain a list of vendor/model strings and
> kernel modules (newline separated). I now want to combine these two
> lists to one list with lines of the following form:
>
> module:model_info
>
> How can this be done with only the tools available on d-i images? Eric
> Gillespie of Progeny simply keeps repeating that it should be easy and
> I'm almost convinced that I might be stupid, but me and pere didn't find
> an easy way to achieve this. The only thing I can imaging is writing a
> little C program that does this.
The appended hack works as long as both lists have the same length.
Thiemo
#!/bin/sh
#
dumb_join ()
{
for i in $second; do
echo $i:$1;
shift
done
}
first=$(cat $1)
second=$(cat $2)
dumb_join $first
Reply to: