I want to compress multiple lines of string having some common elements into single or fewer lines by replacing the changing values with wildcard character.
Example
Input:
Lorem ipsum dolor sit amet_0
Lorem ipsum dolor sit amet_1
Lorem ipsum dolor sit amet_2
Cursus risus at ultrices mi tempus imperdiet
Cursus risus at scelerisque mi tempus imperdiet
Output:
Lorem ipsum dolor sit amet_*
Cursus risus at * mi tempus imperdiet
Is there any tool that I can use for this purpose ? If not, what are the ways to achieve this? Thanks
I tried finding any tool which does this but didn't find any.
I am not sure if you have already found a tool to do this for you. But if I would do this, I think I would use VSCode to find and replace the regex and then remove the duplicates.
Generic step/logic:
To do this using VSCode, you may do the following:
Lorem ipsum dolor sit amet_(.*)Lorem ipsum dolor sit amet_*^(.*)(\n\1)+$$1Repeat the same steps for the other lines:
Cursus risus at (.*) mi tempus imperdietCursus risus at * mi tempus imperdiet