Seperating one word into columns

Hi,

Our issue is that we want to separate a string of characters, like

xyxyxyxxxxyyxyxy

into a column,
x
y
x
y
...

I'm sure there's an easy awk fix for this, but being inexperienced, I figured I would ask on here.

Thanks a lot in advance!

echo "xyxyxyxxxxyyxyxy" | \
awk ' {
       for(i=1; i<=length($0); i++) {print substr($0,i,1)} 
       }'

Okie dokie,

Now all I have to do is to figure out how to use that to pick our line out of our files and go. And that shouldn't be too terribly hard. Thanks a million!

~NovaGhostii

# echo "xyxyxyxxxxyyxyxy" | awk 'BEGIN{FS=""}{for (i=1;i<=NF;i++)print $i}'

or

echo "xyxyxyxxxxyyxyxy" | awk 'BEGIN{FS="";OFS="\n"}{$1=$1}1'

A SED one

$ echo "xyxyxyxxxxyyxyxy" | sed -e 's/[a-z]/& \n/g'

//Jadu