I am not able to get substring syntax using awk to work in my UNIX script (using IBM AIX and Korn Shell). I want to look at the first record from my data files and then copy the data file to a new file name based on a string in the first record. In the example (first record from data file) below the data file is called "btpy30". I want to look at "PY3012B" in the first record below and since I have "B" at the end I want to copy this data file btpy30 to btpy30b. I would really appreciate it if anybody has any ideas on how to accomplish this! Thanks for your help.
Example of record:
PY3012B 04 ME06302003 12B MED PAYROLL EXPENDITURE ME0406302003
20030630011000 3314 NN 04
000000000000011311
1.08
Example of record:
PY3012B 04 ME06302003 12B MED PAYROLL EXPENDITURE ME0406302003
20030630011000 3314 NN 04
000000000000011311
1.08