Not w(h)orking :((( !!!
2016-03-31 11:30 GMT+02:00 Catalin Muresan <[email protected]>: > Prea tarziu > > [cata@lemon ~]$ echo "00:70:80:90:A0:FF"| awk -n -F':' '{printf > ("%s:%s:%s:%s:%s:%02X\n", $1,$2,$3,$4,$5,(strtonum("0x"$6)+1)%0x100 );}' > 00:70:80:90:A0:00 > > > 2016-03-31 10:24 GMT+01:00 Petru Rațiu <[email protected]>: > > > Mi-e lene sa fac proof of concept acu, da' as scoate doopunctele, as face > > increment si le-as pune la loc. > > > > Aaaa, zici ca stii tu sigur ca nu face overflow? vezi ca gawk stie de > > strtonum: > > > > echo AF | gawk ' { printf "%X\n", strtonum("0x"$1)+2 }' > > B1 > > > > -- > > P. > > > > > > 2016-03-31 12:06 GMT+03:00 Mircea Ciocan <[email protected]>: > > > > > Ajutati si voi un om batran si mai apropriat de hw decat de sed si awk: > > > > > > am un shell deosebit de castrat pe un device, fara aritmetica si fara > cut > > > si o adresa de Ethernet MAC intr-o variabila de tipul: > > > > > > MAC0="00:70:80:90:A0:5A" > > > > > > vreau sa incrementez ultimul numar ( se presupune ca nu va face > overflow) > > > cu 2 si in exemplul de mai sus sa iasa: > > > > > > MAC2="00:70:80:90:A0:5C" > > > > > > cum Doamne iarta-ma fac asta cu awk si/sau sed > > > > > > > > > Mircea "let's castrate the shells" C. > > > _______________________________________________ > > > RLUG mailing list > > > [email protected] > > > http://lists.lug.ro/mailman/listinfo/rlug > > > > > _______________________________________________ > > RLUG mailing list > > [email protected] > > http://lists.lug.ro/mailman/listinfo/rlug > > > _______________________________________________ > RLUG mailing list > [email protected] > http://lists.lug.ro/mailman/listinfo/rlug > _______________________________________________ RLUG mailing list [email protected] http://lists.lug.ro/mailman/listinfo/rlug
