Here is the file I need to deal with.
ENR1;203023;0000;H606626;001505;EL;00;1234;0000100;00;00;201346100;H6022418;
ENR6;000218;130155;000;00;201443;000000000;000000000;000000000;000000000;
ENR1;203357;0000;H606626;001653;EL;01;2546;0000800;00;00;201346100;H6022418;
ENR6;000218;130155;000;00;201503;000000000;000000000;000000000;000000000;
ENR6;001811;150316;000;00;201624;000000000;000000000;000000000;000000000;
ENR1;203385;0000;H606625;000615;EL;00;5861;0000100;00;00;201346100;H6022418;
I must substitute field 7 of each line. If the value is 00
, then I must set it to 01
.
But only for lines whose first field is ENR1!
awk -F';' -v OFS=';' 'NR>=1{sub("00","01",$7)}1' file > result
This works but also remplace field $7 with lines beginning with ENR6.
How adding the condition (only lines starting with ENR1?)