I have a requirement where I'm getting a .txt file in output from some tool and I want to split that into three.
Example text from file:
First line
Second line
23456
45677
45678
Third line
90909
90678
Last line
Z567Z
6787T
Expected outputs:
-> file1.txt
23456
45677
45678
-> file2.txt
90909
90678
-> file3.txt
Z567Z
5677T
Basically, files will have 5 digit numeric/alphanumeric values which we want to use, and text in between works as identifier to split file into multiple files.
I'm looking to use awk
or sed
command to do this.