tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
help with awk
Given the following line(s) of a file as an example:
source = { git = "https://github.com/Beaglefoot/tree-sitter-awk", rev = "a799bc5da7c2a84bc9a06ba5f3540cf1191e4ee3" }
and this awk script:
BEGIN { print "# $Net" "BSD$"; }
/(^|\n)source =/ {
for (i = 1; i <= NF; i++) {
sub("\"","")
sub(",","")
split($i, f, " ")
print "field f["$i"]"
if (f[$i] ~ /^https/)
name=f[6]
if (f[$i] ~ /[a-f0-9]{40}/)
vers=f[9]
print name
print vers
}
print "DISTFILES+=\t" name "-" vers ".tar.gz"
}
# SITES.name-vers.tar.gz= -url/archive/vers.tar.gz
#/^source = {/ { print "DISTFILES+=\t" name "-" vers ".tar.gz"; }
what do I fix to correctly output
DISTFILES+= name-vers.tar.gz
SITES.name-vers.tar.gz= -url/archive/vers.tar.gz
where name is the last path part of url?
I know I'm still missing filtering the name from the url, and basically
everything else, as it's been too long since I had to work in awk.
This is to spare myself or whoever updates editor/helix to do the same
copy-pasting 30+ minutes process again and again with every new release.
Home |
Main Index |
Thread Index |
Old Index