I would like to write a shell script to screen on some conditions for a given line and if valid perform 2 substitutions on that line otherwise the line shall remain as-is.
Here is the file:
1234NYABC1LMA
2334NJABC0TR3
4234NJABC1LMA
5234PAABC1LMA
8234SCABC1ZBC
If the state (columns 5 and 6) is either NY or NJ
and the Validity Indicator (column 10) is 1
then replace the state (columns 5 and 6) with NE
and replace column 13 with a Y, otherwise the line remains the same:
the output would be:
1234NEABC1LMY
2334NJABC0TR3
4234NEABC1LMY
5234NEABC1LMY
8234SCABC1ZBC
Any tips would be greatly appreciated.
Thanks
Here is the file:
1234NYABC1LMA
2334NJABC0TR3
4234NJABC1LMA
5234PAABC1LMA
8234SCABC1ZBC
If the state (columns 5 and 6) is either NY or NJ
and the Validity Indicator (column 10) is 1
then replace the state (columns 5 and 6) with NE
and replace column 13 with a Y, otherwise the line remains the same:
the output would be:
1234NEABC1LMY
2334NJABC0TR3
4234NEABC1LMY
5234NEABC1LMY
8234SCABC1ZBC
Any tips would be greatly appreciated.
Thanks