You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
configs/dot.zsh/find-next-arg.awk

22 lines
406 B
Awk

#!/usr/bin/awk -f
BEGIN {
curpos = 5 # predefined cursor position for testing
z = 0
len = 0 # the current length
arg = "hans im glueck"
orig = arg
#while ( z < ARGC || ( len < curpos )) {
arg = substr(arg, curpos);
if ( substr(arg, 1, 1) == " " ) arg = substr(arg, 2);
curpos += index(arg, " ");
print curpos;
print orig;
while ( z < curpos ) {
printf("%d", z);
z++;
}
print "\n";
}