Forum Discussion

sindhu10's avatar
sindhu10
Contributor
7 years ago

How to replace a text from file

11/04/18,15:35,01:00,Slot -1,Sk Jan 23 Test Movie-1,03,,07,,CRIME,18,,06,,"Host has to offer.",2017,,,ENG,DMC5121,,,60,,,,,,,,,,,,1|3,60,VOD,M,,,N
11/04/18,16:35,01:00,Slot -2,SK Jan 23 Test Movie-2,03,,07,,CRIME,18,,06,,"Host has to offer.",2017,,,ENG,DMC5122,,,60,,,,,,,,,,,,1|3,60,VOD,M,,,N
11/04/18,17:35,01:00,Slot -3,SK Jan 23 Test Movie-3,03,,07,,CRIME,18,,06,,"Host has to offer.",2017,,,ENG,DMC5123,,,60,,,,,2,6,SK New Season 2,,,,,1|3,60,VOD,,,,N

 

In the  below text file I need to replace all the dates and add a character  before DMC5121 , DMC 5122 , DMC5123 inside the file.

 

Can anyone help me pls  

 

Thanks,

 

4 Replies

  • NisHera's avatar
    NisHera
    Valued Contributor

    what langue are you using?

    what date format used? 

    is it always in same place in the line (I could see all of them begging of the line) or all over?

     

    most probably you may have to use regex, depending reply to above questions regex could be different.

    regex document can be found hear   generally it is quite complex

     

    there could be a more simple solution if you are creating this text file from some application/web page fields

    so you can tackle write at the source. 

     

     

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    What are you trying to test with this?

    It looks a lot like a coding test that I took awhile back for a job interview.

    • sindhu10's avatar
      sindhu10
      Contributor

      I just want to replace the dates and text in the file and need to reuse the file to import in desktop application

      • NisHera's avatar
        NisHera
        Valued Contributor

        what make you to automate it?

        what I would do manually import to excel file and changes done using macro.