I have a | delimited file with 132 fields in every record, what I need to do is append the last 2 bytes in field 3 to field 1 than print the entire record:
example of the input record
field1 field2 field3 field4 field5 .... field 132
123456 xyz 01/28/99 xyz123 xyz145 .... xyz567
the output should be:
field1 field2 field3 field4 field5 .... field 132
12345699 xyz 01/28/99 xya123 xyz145 .... xyz567
Here's the script that I have:
#!/bin/ksh
IFS="|"
while read a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11; do
yy=`expr substr "$a3" 7 2`
acyy=$a1$yy
print $acyy $a2 $a3 $a4 $a5 $a6 $a7 $a8 $a9 $a10 $a11
done < infile.txt > outfile.txt
is there a way to read and print all remaining fileds?
Please help and thank you