How to make awk consider a new line, compare it with those already considered and, if it met a coincidence, add it to an existing file, and if it were new, then create a new file where all lines with the same sign would be added ?
The problem is with the creation of a large number of files, with new names ... the algorithm must invent them or call these files by the name of the string (I think), otherwise I can not imagine how to generate names that can be oriented.
If someone came across a similar problem splitting a large amount of data, I would be grateful for a hint how to write it in accordance with the awk syntax.
awk? If the task is so complicated, it will be faster to write in C ++. Or in C #: IEnumerable <string> ReadConsoleLines () {string line; while ((line = Console.ReadLine ())! = null) yield return line; } foreach (var group in ((filename! = null)? File.ReadLines (filename): ReadConsoleLines ()). GroupBy (l => selector)) File.WriteAllLines (FileNameFromKey (group.Key), group); You can create an array of already encountered strings onawk, and add a new string to it when a new string is detected. - VladD