PaulDotCom mailing list archives
Advice: Bash Scripting
From: eharrison at gmail.com (Erik Harrison)
Date: Sat, 1 Nov 2008 20:55:40 -0400
dump out all the raw info to a text file. try the following.. totally going based on how it looks in my head and not having actually tested it, so.. you'll probably need to tinker: cat textfile | sed -e 's/^Answer/\",\"Answer/g' ^should add in the "," before answer cat textfile | sed -e 's/^QUESTION/\"QUESTION/g' ^should add in the " before question cat textfile | sed -e 's/Answer\:\ A/Answer\:\ A\"/g' ^replace the answer line entirely with the same value with a " at the end. repeat as necessary for all possible options redirect the outputs as necessary, or chain it together into one long set of commands.. whatever suits you. definitely more efficient or more elegant ways to perform this, but what do you want for free? :P 2008/11/1 Arch Angel <arch3angel at gmail.com>:
Hello Everyone, I have a project to help me study for certifications, by taking PDF files and converting those into text files, then from text files create a csv file, which in turn will be imported into jMemorize (http://jmemorize.org/). I know this seems like a great bit of work, but using flash card style studying helps me a great deal as well as others who can use the same data once it is created. I am looking for some help in making the text file to a cvs file via a script. I can make the PDF into a text real easy, extract the garage to leave the just the questions and answers, but from this point it is manual copy paste which I want to try and avoid. Now reading through the jMemorize website and playing with the file contents I was able to find that the jMemorize application exports the questions into a cvs file and when opened in say notepad++ I get the following for each question: "QUESTION 02: Which configuration command correctly sets the encapsulation type for a PPP over ATM interface? A. encapsulation ppp B. encapsulation pppoa C. encapsulation aa15mux D. encapsulation aa15snap","Answer: A A. encapsulation ppp","Juniper_JNCIA_ActualTests_JN0-120_05-25-2007",0 This was an example of the original text file entry: QUESTION 2: Which configuration command correctly sets the encapsulation type for a PPP over ATM interface? A. Encapsulation ppp B. Encapsulation pppoa C. Encapsulation aa15mux D. Encapsulation aa15snap Answer: A Is it possible to create a script that will add a " before the QUESTION and then add a "," before the Answer with a " at the end of the Answer line? If I could execute this script it would save me hours of time creating these databases for flashcards and in turn help me pass my certifications. Thanks ahead of time for all the help and advice! _______________________________________________ Pauldotcom mailing list Pauldotcom at mail.pauldotcom.com http://mail.pauldotcom.com/cgi-bin/mailman/listinfo/pauldotcom Main Web Site: http://pauldotcom.com
Current thread:
- Advice: Bash Scripting Arch Angel (Nov 01)
- Advice: Bash Scripting Erik Harrison (Nov 01)
- Advice: Bash Scripting Arch Angel (Nov 02)
- Advice: Bash Scripting Erik Harrison (Nov 01)