I have a text file with a bunch of data. I was able to extract exactly what I want using sed; but I need to replaced only the specific pattern I searched without losing the other content from the file.
Im using the following sed command; but I need to the replacement; but dont know how to do it.
cat file.txt | sed -rn '/([a-z0-9]{2}\s){6}/p' > output.txt
The sed searches for the following pattern: ## ## ## ## ## ##, but I want to replace that pattern like this: ######-######.
cat file.txt | sed -rn '/([a-z0-9]{2}\s){6}/p' > output.txt
Output:
1         | ec eb b8 7b e3 c0  47                
9         | 90 20 c2 f6 3d c0  1/1/1             
25        | 00 fd 45 3d a7 80  31
Desired Output:
1         | ecebb8-7be3c0  47                
9         | 9020c2-f63dc0  1/1/1             
25        | 00fd45-3da780  31
Thanks
 
     
     
     
     
    