confuseddddd
Programmer
Used this script to remove the asterick from the 2nd field where sometimes contains an asterick.
> awk 'BEGIN { FS=OFS="*" }
> {
> if ($1=="CLM"
{
> while ( $3 !~ /^[0-9]*[.][0-9][0-9]$/ ) {
> $2=$2 $3;
> for (x=3; x<split($0,a); x++)
> $x=$(x+1);
> }
> print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25;
> } else {
> print $0;
> }
> }' $(date -u +%Y%m%d).IN > $(date -u +%Y%m%d).001
However, because the fields in the record can vary, I am getting strange results:
original:
CLM*SANAR00 7072*65.00*WC**11^^1******EM^^^TX
after script
CLM*SANAR00 7072*65.00*WC**11^^1******EM^^^TX*************
original:
CLM*GALKA001 9778*295.00*WC**11^^1******EM^^^TX
after script:
CLM*GALKA001 9778*295.00*WC**11^^1******EM^^^TX*************
original:
CLM*TATMI004569*100.00*WC**11^^1******EM^^^TX********29
after script
CLM*TATMI004569*100.00*WC**11^^1******EM^^^TX********29*****
original:
CLM*37494-002*97.70*WC**11^^1******EM^^^FL
after script
CLM*37494-002*97.70*WC**11^^1******EM^^^FL*************
original:
CLM*001129S5 FWC*615.00*WC**11^^1******EM^^^FL
after script
CLM*001129S5 FWC*615.00*WC**11^^1******EM^^^FL*************
original:
CLM*350049582*35*388.00*WC**11^^1******EM^^^KS
after script
CLM*350049582*35*388.00*WC**11^^1******EM^^^KS*************
Anyone have any ideas on how to remove the unwanted asterick from the second field but still leave the rest of the record alone???
> awk 'BEGIN { FS=OFS="*" }
> {
> if ($1=="CLM"
> while ( $3 !~ /^[0-9]*[.][0-9][0-9]$/ ) {
> $2=$2 $3;
> for (x=3; x<split($0,a); x++)
> $x=$(x+1);
> }
> print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25;
> } else {
> print $0;
> }
> }' $(date -u +%Y%m%d).IN > $(date -u +%Y%m%d).001
However, because the fields in the record can vary, I am getting strange results:
original:
CLM*SANAR00 7072*65.00*WC**11^^1******EM^^^TX
after script
CLM*SANAR00 7072*65.00*WC**11^^1******EM^^^TX*************
original:
CLM*GALKA001 9778*295.00*WC**11^^1******EM^^^TX
after script:
CLM*GALKA001 9778*295.00*WC**11^^1******EM^^^TX*************
original:
CLM*TATMI004569*100.00*WC**11^^1******EM^^^TX********29
after script
CLM*TATMI004569*100.00*WC**11^^1******EM^^^TX********29*****
original:
CLM*37494-002*97.70*WC**11^^1******EM^^^FL
after script
CLM*37494-002*97.70*WC**11^^1******EM^^^FL*************
original:
CLM*001129S5 FWC*615.00*WC**11^^1******EM^^^FL
after script
CLM*001129S5 FWC*615.00*WC**11^^1******EM^^^FL*************
original:
CLM*350049582*35*388.00*WC**11^^1******EM^^^KS
after script
CLM*350049582*35*388.00*WC**11^^1******EM^^^KS*************
Anyone have any ideas on how to remove the unwanted asterick from the second field but still leave the rest of the record alone???