AWK with nondelimited files

Greets all. I have a record "123456789" and I wish to print $1$2"," and $8-EOL

I have looked many places. I have tried gawk -F"" but no luck. I appreciate your help.

Most sincerely,
Rick

What would be $1, $2, and $8 in your example? Anyway, with non-delimited files man cut (POSIX) might better suit your needs.

Try it with a space between -F and the quotes "":

awk -F ""

instead of:

awk -F""

I've always found cut a pain to use it's so limited e.g. If I wanted fields $8, $8 and $2 it outputs the fields in input order and only once! Not what I asked for:

$ echo "123456789" | cut -c8,8,2
28
$ echo "1,2,3,4,5,6" | cut -d, -f5,2,1-2
1,2,5

I wasn't clear enough. I want to print out, from an undelimited record, for example: 1234567890 is the record and I want to print the third and fourth characters, then everything from the eighth to the end of the line.

Thanks again,
Rick

echo 123456789 |awk -F "" '{print substr($0,3,2) substr($0,8)}'

3489 

Well, this is one of the rare cases where cut will actually do what you need (as you want characters in the source order and you don't require any duplicates):

$ echo "123456789ABCDEF" | cut -c3-4,8-
3489ABCDEF

Dear rdcwayx and Chubler_XL,

You are the greatest. thank you both so very much. I have it now.

Most sincerely,
Rick D