Hi ,
I have a file which has a line starts with $segment_name and has the below data
source data
$Segment_Name = 123.ABC.123.01.txt
$Segment_Name = 123.ABC.ABC.txt
$Segment_Name = 123.ABC.12A3.txt
My target data should be
$Segment_Name = 123.ABC.123.01.txt
$Segment_Name = 123.ABC.ABC.01.txt
$Segment_Name = 123.ABC.12A3.01.txt
I found the below code from this forum, it is adding the .01 extension to all the lines as below
sed '/^$Segment_Name/ s/\([^\d]\).txt/\01\.01\.txt/' input
$Segment_Name = 123.ABC.123.01.01.txt
$Segment_Name = 123.ABC.ABC.01.txt
$Segment_Name = 123.ABC.12A3.01.txt
I don't want to add 01 before the file extension if the 01 is already present(line no 1 in the above example).please help me to tweak the code
Regards,Shruthi