WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: search provides.db and sizelist  (Read 172 times)

Offline mocore

  • Hero Member
  • *****
  • Posts: 646
  • ~.~
search provides.db and sizelist
« on: October 02, 2024, 06:58:21 PM »

 ::)

Code: [Select]

# wget http://tinycorelinux.net/14.x/x86/tcz/provides.db.gz
# wget http://tinycorelinux.net/14.x/x86/tcz/sizelist
ps() { zcat ./provides.db.gz | awk -v"str=$1" '
BEGIN{ insec_flag=0;matcharr[0]="";fa[0]=""  }
{if(FILENAME ~ "sizelist" ) { split( $0,sl," "); if(sl[1] in matcharr) print } }
{if($0 == "") insec_flag=0 }
/tcz/{ insec_flag=1;section=$0; fa[section]="";    } 
{if( $0 !~ "tcz"){ 
   split($0,fp,"/");
   if( fp[length(fp)] ~ str ){ matcharr[section]= "" matcharr[section] "\n" $0 } } 
}
END{   for( i in matcharr) print i matcharr[i] }' - ./sizelist ; }

#eg
# ps  '^gio$'
Quote
glib2.tcz 1564672
glib2.tcz
/usr/local/bin/gio
# ps  '^file$'
Quote
file.tcz 610304
go.tcz 37777408
file.tcz
/usr/local/bin/file
/usr/local/tce.installed/file
go.tcz
usr/local/go/src/net/http/testdata/file