s243a icon

distro_pkgs_specs__to__compat_pkg.awk

s243a | PRO | 12/26/20 06:26:19 AM UTC (Edited) | 0 ⭐ | 893 👁️ | Never ⏰ | []
Awk |

350 B

|

None

|

0 👍

/

0 👎

#!/usr/bin/gawk -f
BEGIN {FS="|"
       mode="parse_var"}
/PKGS_SPECS_TABLE=[[:space:]]*$/ {mode="PKGS_SPECS_TABLE";next}
/'[[:space:]]*$/ {mode="parse_var"; next} 
{
if ($1 == "yes"){
      if (length($3)==0){
        print $2 "|" $2  
      } else {
          split($3, pkgs , ",")
          for (a_key in pkgs){
            print pkgs[a_key] "|" $2 
          }
      }
    }
}

Comments