awk silliness

This one-liner will print every other character in upper case.

oracle@emgrid01 ~ >echo "the quick brown fox jumped over the lazy dog" | awk -F "" '{for (i=1; i <= NF;i++) {if (i % 2 == 0) {printf ("%s",$i)} else {printf ("%s",toupper($i))}};print ""}'
ThE QuIcK BrOwN FoX JuMpEd oVeR ThE LaZy dOg
oracle@emgrid01 ~ >

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.