I have source file like below
"position" file
HABCDEFDSKLKFSDFSDK <--- HEADER RECORD
217ABC1000,3000
217ABC1000,3000
218ABC1000,3000
217ABC1000,3000
218ABC1000,3000
218ABC1000,3000
217ABC1000,3000
217ABC1000,3000
TXYZ0008DATETIME <--- TRAILER RECORD (0008 is record count)
My target output file
HABCDEFDSKLKFSDFSDK <--- HEADER RECORD
217ABC1000,3000
217ABC1000,3000
217ABC1000,3000
217ABC1000,3000
217ABC1000,3000
TXYZ0005DATETIME <--- Trailer record (0005 is record count)
I have used following command
header -1 position > testfile
grep "^217" position >> testfile
I don't know how to get record count and update trailer record and appended to target file
test
If anybody has suggestion
"position" file
HABCDEFDSKLKFSDFSDK <--- HEADER RECORD
217ABC1000,3000
217ABC1000,3000
218ABC1000,3000
217ABC1000,3000
218ABC1000,3000
218ABC1000,3000
217ABC1000,3000
217ABC1000,3000
TXYZ0008DATETIME <--- TRAILER RECORD (0008 is record count)
My target output file
HABCDEFDSKLKFSDFSDK <--- HEADER RECORD
217ABC1000,3000
217ABC1000,3000
217ABC1000,3000
217ABC1000,3000
217ABC1000,3000
TXYZ0005DATETIME <--- Trailer record (0005 is record count)
I have used following command
header -1 position > testfile
grep "^217" position >> testfile
I don't know how to get record count and update trailer record and appended to target file
test
If anybody has suggestion