guys I'm quite new on coding world. I would like some advises here Here's example of my raw data. it's quite hard to look on I would like to cut these lines to seperate each data into better view on AIX server
0000031 C9999999999.999000CCN20001 121213.0000000000000.00099999999999999.99901 0000000121213.0000000000000.0000000000000.000000003 VP01003C000003 0.000
0000036 B9999999999.999050CC8200010000000000.0000000000000.00099999999999999.99901 000 315799.0410000000000.0000000090000.000000003 VP03003C000003 0.000
into this format with header column on it as a final result
char CustID[10]; /* xxxxxxxxxx */
char AccType; /* C/A/M/B */
char CreditLimit[14]; /* 9(10).999 */
char MarginCode[3]; /* 999 ; 00 for CASH */
char CustType; /* C,F,M,P,I,O,U,S */
char CommCustType; /* x */
char CreditType; /* 1/2/3/4/8/9/H/N */
char CreditLine; /* 1/2/3/4 */
char TraderID[4]; /* 9999 ; A/O */
char BuyTotalCredit[14]; /* 9(10).999 */
char SellCredit[14]; /* 9(10).999 */
char LimitPercentApprove[3]; /* 999 */
char LimitValuePerOrder[15]; /* 9(8).999 */
char SubAccCode[2]; /* 99 ; 01 for fis broker */
char SubBrokerID[2]; /* xx ; [ ] */
char MutualFundID[2]; /* xx ; [ ] */
char BranchID[2]; /* 99 ; [00] */
char SubAccFlag; /* 0, 1 ; [0] */
char CashBalance[14]; /* 9(10).999 */
char Debt[14]; /* 9(10).999 */
char Collateral[14]; /* 9(10).999 */
char CustCode[10]; /* xxxxxxxxxx ; [= CustID] */
char Market;
char CalCommMethod;
Is there's anyway to do with shell like..
input account number :
0000031
read $accno
then used grep $accno $filename.dat
then we get
0000031 C9999999999.999000CCN20001 121213.0000000000000.00099999999999999.99901 0000000121213.0000000000000.0000000000000.000000003 VP01003C000003 0.000
after this, I guess if it's java could we use array ? what about shell ?
while
read $format.txt
10,1,14,3,1,1,1,1,4,14,14,,15,2,2,2,2,1,14,14,14,10,1,1
or it should be the range
0-9,10,11-24,...
substr()function inawkto extract fields of the line by range of character positions.