From a tab-based tree-like file, I'd like to get a flat-file DB (I think I'll make a program out of it and probably using ECMAScript/JavaScript, but whatever I end up doing I need a DB to start with). The file have different 1st-level block items, that is starting right after \n and ending just before either "\n\w" or EOF (end of file); I'm only interested in a certain kind: starting with "\nsystem\s", which I'll refer to as "system". A good portion of systems have a 2nd-level (non-block) item, that is starting right after \n\t and ending just before either "\n" or EOF (end of file); I'm only interested in those starting with "\n\tlink\s", which I'll refer to as "link"; any of those cases have > 1 link. I'm thinking the links can be in a CSV. All systems have a single 2nd-level "pos", which has 2 digits, that can be negative. To summarize: Not all 1st-level items are systems but I'm only interested those. Some systems have no link, a decent portion have just 1, and a large portion have > 1, whichever of those cases I need links to be listed. A good portion of names, be it system or link are double-quoted which I don't want (the quotes). The input file is https://github.com/endless-sky/endless-sky/blob/master/data/map.txt and the following is its current version 1st 2 systems trailed by an example of a system without a link and after is the output I'm looking to have from that. I'd prefer to run the regex in Notepad++, but worse case I have Cygwin so I could use some *nix tools although please note often Cygwin version is old (so if someone want me to use the latest *nix tool, there's a decent chance I won't be able to in Cygwin). Thank you kindly for your help Sample input ```text # Copyright (c) 2014 by Cookie Monster system "1 Axis" pos -1274.63 267.214 government Coalition habitable 745.92 belt 1112 link "Sol Kimek" link "4 Winter Rising" link "4 Spring Rising" link "3 Axis" asteroids "small rock" 8 3.3166 asteroids "medium rock" 11 3.4454 asteroids "large rock" 1 3.1556 asteroids "small metal" 1 3.381 asteroids "medium metal" 149 4.347 asteroids "large metal" 11 3.9606 minables lead 11 6.87213 minables silicon 35 6.68659 minables tungsten 2 5.45307 trade Clothing 251 trade Electronics 831 trade Equipment 469 trade Food 231 trade "Heavy Metals" 1241 trade Industrial 767 trade "Luxury Goods" 1135 trade Medical 777 trade Metal 520 trade Plastic 384 fleet "Small Arach" 700 fleet "Large Arach" 1500 fleet "Small Kimek" 300 fleet "Large
DynV
Posts
-
TSV out of a tab-based tree-like file -
Employment OddsI've been pretty lucky in my job search but I considerably put odds on my side by working on my employability skills, right off the bat my boss told me he hired me because I seemed to be a go-getter ! From my small experience, there seem to be no course that would've helped me with the skills to make the job, working efficiently (not perfectly) and completing your projects will probably be a great asset.
Je vous salue du Québec !
-
encapsulation VS development timeI was looking back at my first worthwhile project and I notices that I made a more than a few functions to separate my code as it was getting cramped. While it seems to do the job, it is harder to maintain and is far from the ideals of Object-Oriented Programming (OOP), especially the encapsulation aspect ! Refactoring the code seems attractive but the time expenditure doesn't seem to outweigh the advantages I'd have from fast maintenance and portability as it seems too project-specific. However, I'm looking for a general guideline so that I may approach the solution from a more distanced point of view.
Je vous salue du Québec !
-
Canada DayI'd be very glad to join the united states if it didn't include JesusLand ( http://en.wikipedia.org/wiki/Jesusland\_map ) ! Unfortunately there's a bit of warmongering here in Canada too, so might as well not include it in the fusion as this more accurate map shows : http://westernstandard.blogs.com/photos/uncategorized/exilemap.jpg PS: Québec is the light blue area. ;)
Je vous salue du Québec !
-
Canada DayHappy Canada Day ! I was about to rant about federalism but it's not the time. ;)
Je vous salue du Québec !
-
Brings back memories [modified]OMFG ! :laugh: Did his manager review ANY of his work ?
Je vous salue du Québec !
-
3 years back I wrote like this :)This doesn't register with me, I learned threads with Java ... Maybe comment and point out mistakes ?
Je vous salue du Québec !
-
at least he triedROFL ! :laugh: I REALLY hope that he doesn't get hired to program an elevator controller or people will will wait a long time before getting to their level.
Je vous salue du Québec !
-
Insert a quote into a @-quoted string literal [modified]He most probably didn't understand what he was doing, that's sad.
Je vous salue du Québec !
-
Nested loops - gotta love themWow that was some real newbie mistake ! But what does that say about the organization that implemented his code without verification ?
Je vous salue du Québec !
-
Job Fraud by US IT EmployersA 10$ / day Indian programmer ? Anyway serious companies do serious business and the others start by exploiting employees, then their clients and eventually loose their business.
Je vous salue du Québec !