All,
I have a file where strings appear on each line in following format:
STRING1
STRING2
STRING1
STRING1
STRING1
STRING3
STRING4
STRING4
STRING5
STRING6
STRING5
I want to find which strings appear consecutively in the file, using bash script. For e.g., in the above example, STRING1 and STRING4 appear consecutively and should be there in the output. Note, even though STRING5 appears twice, it isn't appearing consecutively.
I don't want to sort the file as the file size would be normally large and that would add overhead. The user would supply the string and the script would says if the string appears consecutively in the file.
FYI, the strings might have unwanted spaces after them.