I have the following text file:
#unimportant comment
#possible more unimportant comments
#info1 info2 info3 ,importantname1
importanttext1
#info1 info2 info3 ,importantname2
importanttext2
#info1 info2 info3 ,importantname3
importanttext3
I want to break each file down into separate files. All I really need is to extract the non-commented urls , preserving comments is optional. I want each file to be named such as importantname1.txt or the name following the comma at the end of each comment line appended with .txt
so importantname1.txt would have the following contents:
importanttext1
or possibly
#info1 info2 info3 ,importantname1
importanttext1
so the line would be extracted and saved with the filename after the comment and appended with .txt in this case filename importantname1.txt
In need to do this for each set of lines in the example file. Preserving the comments is unimportant but I need it to be script-able. I also need to account for an unknown number of comment lines in the header. The comment line will always be there before each importanttextX line
importanttextalways be a single line, or are multiple lines possible?