Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 1. do you have a complete list of keywords? or can they only be discovered by processing the input file? 2. is "some x" always two words, or can it be text of any arbitrary length? Commented Apr 19, 2021 at 16:32
  • @cas yes, I have a complete list of keywords. They could also be discovered by scanning for words in CAPS but thats not necesserily needed for my use case. "some x" can be text of any arbitrary length, which makes this tasks a little bit more complex. I assume one has to scan the line for a keyword (they always appear in the same order) and if its not found, increase a counter. Than insert the needed amount of semicolons for the next found keyword. Commented Apr 19, 2021 at 16:46
  • how do you determine the order of the output fields on each line of output? alphabetic sort? e.g. if scanning the file, you find keys A, B, C on line 1, then new keys E and F on line 2, and key D on line 3 - are the fields output in sorted order ABCDEF, or in discovered order ABCEFD? I presume sorted. Of course, if the keywords are known in advance, a fixed order can be used. Commented Apr 19, 2021 at 16:50
  • also, do you care if the output is aligned in columns visually, or only care that there is a semi-colon separating fields? Also, why does your sample output NOT have some e for the third output line? is that intended or a mistake? Commented Apr 19, 2021 at 16:53
  • @cas only the semicolon is important to have the parsed data imported into another programm. Since the keywords and their order are known in advance, a fixed order can be specified. In a single line, the keywords are also unique (not appearing multiple times in a line) Commented Apr 19, 2021 at 16:56