I am using the Ubuntu bash. My file contains paths from a filesystem.
C:\users\username\subfolder\thisismyfile.txt C:\users\username\subfolder\thisismyfileplusadate.txt C:\users\username\subfolder2\thisismyfileplusname.txt C:\users\username\subfolder3\thisismyfile.txt
What I want to do:
Compare each start of each line with the start of the next line.
First n characters of line 1 first n characters of the following line. If this substring is identical I want to compare the complete length of the two lines and the longer path of the two should be printed to an output file concatenated with the length of that longer path.
So for my example above:
The first n characters, let's say 28 so "C:\users\username\subfolder\" would be compared. They are identical. Next I want to compare the length of the lines to each other. Line 1 would be 44 characters and line 2 53.
So I want to print line 1 to an output file and concatenate "length: 53" to the string (or the beginning of the line)
How would I go about this?