File Processing - How to Replace particular record

I have a file with data as

1                             
L                             
1                             
Used                          
1                             
1                             
1                             
1                             
L                             
1                             
L                             
1                             
V�hicule d�occasion           
1                             
1                             
1                             
1                             
1                             
V�hicule d�occasion           
1                             
1                             
1                             
Used                          
1                             
Used                          
1                             
1                             
1                             
1                             
1                             
1                             
V�hicule d�occasion           
1                             
1                             
1                             
V�hicule d�occasion           
V�hicule d�occasion           
V�hicule d�occasion           
V�hicule d�occasion           
L                             
 

I have to replace the rows having V�hicule d�occasion with abc123 with out effectiong the other records.

Thanks!!!

$ sed "s,\'occasion,occasion,g" infile

Not working!!!

previously you were given a different pattern for replacement .. have you changed it ?? anyway below the code for current requirement..

$ sed "s,V�hiculed\'occasion,abc123,g" infile

Its not working again, may be there are any spl characters & white space at the End.

Onething can we do the same for records starts with V

i.e; like V*

???

Thanks!!!

instead of "*" , try with "." .. This works for me ..

$ sed "s,V.hicule d.occasion,abc123,g" infile
1
L
1
Used
1
1
1
1
L
1
L
1
abc123
1
1
1
1
1
abc123
1
1
1
Used
1
Used
1
1
1
1
1
1
abc123
1
1
1
abc123
abc123
abc123
abc123
L
$
1 Like

Thanks man.... Its working.
I will update if at any case, it fails.

Thanks!!! :slight_smile: