Pipe into a for loop
I want to send the output of some command into a for loop in bash. How can I do that?
Here is an example: let's say I want to run cat, and then send the output of it to a for loop, which reads each line, and tells you the character length of that line. It should be sometihng like:
cat FILE | for i in $1; do print length($i); done
But that doesn't really work. So how can I do that? (I don't want to write and save a script file, I want to do it all on the fly using pipes only).