Portál AbcLinuxu, 7. listopadu 2025 19:10
echo "ENCODEDENCODED" | awk -v width=NNN -f scytale.awk. priklad:
echo 'AIUBN.CUCLXZ' | awk -v width=3 -f scytale # output: ABCLINUXU.CZ. aplikacie: geocaching (mystery caches)
#BEGIN {
#width=6
#}
{
for(i=1;i<=length;i++){
a[i]=substr($0,i,1)
}
}
END{
len=i/width
print "LENGTH is: "len
print "WIDTH is: "width
print "Decyphered text: "
for (j=1;j-1<width;j++){
c=0
pos=j
while (pos < i){
printf "" a[pos]
c=c+1
pos=j+c*width
}
}
print
}
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.