Hi,
I have a file which I need to programmatically split into two files.
All the information in the file before pattern "STOP HERE" is to be stripped and output into one file while everything after "STOP HERE" is to be output into a separate file.
Unfortunately I didn't even know where to start. I was reading up on egrep and I've been having a look at sed as you suggested. If you could throw some more light, I'd appreciate it.
Everything that is not 'STOP HERE' in the input file print but exit at 'STOP HERE' and output to file1, is this what this is doing? I will try this and see how it goes.
String STOP HERE *not* present in the line? -> print line to file1 (actually print to terminal/stdout, but due to stream redirection (>file1) it's printed to file1.
That snippet prints to the file whose name in in FN, preset to "YY" by the first parameter. When "STOP HERE" is encountered, the file name is switched to "XX", and the line in NOT printed due to the "next" directive.