substr() thru awk Korn Shell Script

Hi,

I am new stuff to learn substr() function through awk for writing the Korn shell script.

Is there a way to copy from XXXX1234.ABCDEF to XXX1234 file names without changing both data files?

I appreciate your time to response this email.

Thanks,
Steve

I don't understand your question

Are you copying a file named "XXXX1234.ABCDEF" to "XXX1234"? (#1)

Or are you transforming one file to another and transforming the contents from "XXXX1234.ABCDEF" to "XXX1234"? (#2)

And did you mean to have 4 X's in the first and 3 in the second?

If #2 above, must you use korn/awk? Any of python/ruby/perl/sed would do the job as well.
--
Qman

Hi qneill,

Thanks for your time to review my post.

I knew I am not clear myself because I am not a techie person.

This morning, I reviewed the Similar Thread section and found a solution to separate the file name fields using the awk command.
For example, a file named �XXXX.12345.YYYY� must be changed to �XXXX.12345�.
The echo result of the command line as echo �XXXX.12345.YYYY� | `awk -F. �{print $1}'` is �XXXX�. However, I need to use the same command line above for combining the first two fields of the file named �XXXX.12345� Is there a way to show the results of the first two fields of the file name?

Thanks,
sbryant

echo "XXXX.12345.YYYY" | awk -F. '{print $1"."$2}'

or

echo "XXXX.12345.YYYY" | awk -F. '{printf("%s.%s", $1, $2)}'

Perfect! Thanks for your time and help.