figtool: arrlen

# arrlen takes stdin and returns the length of each line 

#### license: creative commons cc0 1.0 (public domain) 
#### http://creativecommons.org/publicdomain/zero/1.0/

# $ p=$(echo hello | arrlen | awk '{print $1}') ; echo $p
# 5

# $ for p in $(echo "hello there how are you?") ; do echo $p ; done | arrlen
# 5 hello
# 5 there
# 3 how
# 3 are
# 4 you?
# $

function remfrom z p
    f    z    split f p     join f ""    return f
    fig

forin p stdin
    cr 13    chr
    lf 10    chr
    nextline p    remfrom nextline cr    remfrom nextline lf
    now nextline    len    prints    " "    prints
    now nextline    print
    next
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s