In this short article we will see how we can split a file in Linux using a STRING as the split delimiter.
I will use this file as example :
The script does not make any sense, all i need is the string i will use to separate the content into different files.
For the split task i will use the awk commnad
we will look for the "INSERT INTO" string.
The syntax is as bellow:
After you run the command you will end-up with as many new out"n".txt files as you have "INSERT INTO" string findings.
See output results:
I hope this was useful.