Difference between revisions of "Week 6 E-notes Eyanosch"
From LMU BioDB 2015
m |
(Working on the hw and documenting my process, using this page as a template to cut and copy code into) |
||
Line 4: | Line 4: | ||
After downloading the zip files and unzipping them I need to rework the files so they can be loaded into postgreSQL | After downloading the zip files and unzipping them I need to rework the files so they can be loaded into postgreSQL | ||
+ | cat application.txt | sed"s/^/insert into Applications(ApplNo, ApplType, SponsorApplicant, MostRecentLabelAvailableFlag, CurrentPatentFlag, ActionType, Chemical_Type, Ther_Potential, Orphan_Code) values (/g" | ||
+ | |||
+ | * | ||
+ | sed "s/ */ /g" | ||
+ | |||
+ | eyanosch@ab201:~$ cat application.txt | sed "s/ *//g" | sed "s/\t/ /g" | ||
+ | |||
+ | # pulls up information, removes the spaces, and removes the tabs. Adds a space inbetween each column | ||
+ | |||
+ | cat application.txt | sed "s/. /&,/g"| sed "s/ *//g" | sed "s/\t/ /g" | ||
+ | |||
+ | eyanosch@ab201:~$ cat application.txt | sed "s/ *//g" | sed "s/\t/ /g" | sed "s/ /' /g" | sed "s/. /&'/g" | sed "s/ /,&/g" | sed "s/\r$/'/g" | sed "s/^/&'/g" | sed "s/''/null/g" | ||
+ | |||
+ | I had to add ' behind and infront of every character and then the empty spaces that were '' I replaced with the word null | ||
+ | |||
+ | |||
+ | cat application.txt | sed "s/ *//g" | sed "s/\t/ /g" | sed "s/ /' /g" | sed "s/. /&'/g" | sed "s/ /,&/g" | sed "s/\r$/');/g" | sed "s/^/&'/g" | sed "s/''/null/g" |sed "s/^/insert into Application(ApplNo, ApplType, SponsorApplicant, MostRecentLabelAvailableFlag, CurrentPatentFlag, ActionType, Chemical_Type, Ther_Potential, Orphan_Code) values (/g" | sed "1D" > ~/public_html/application.sql.txt | ||
+ | |||
+ | This should give the proper syntax for adding from the database the SQL | ||
Revision as of 02:30, 15 October 2015
Week 6 E-Notes
After downloading the zip files and unzipping them I need to rework the files so they can be loaded into postgreSQL
cat application.txt | sed"s/^/insert into Applications(ApplNo, ApplType, SponsorApplicant, MostRecentLabelAvailableFlag, CurrentPatentFlag, ActionType, Chemical_Type, Ther_Potential, Orphan_Code) values (/g"
*
sed "s/ */ /g"
eyanosch@ab201:~$ cat application.txt | sed "s/ *//g" | sed "s/\t/ /g"
- pulls up information, removes the spaces, and removes the tabs. Adds a space inbetween each column
cat application.txt | sed "s/. /&,/g"| sed "s/ *//g" | sed "s/\t/ /g"
eyanosch@ab201:~$ cat application.txt | sed "s/ *//g" | sed "s/\t/ /g" | sed "s/ /' /g" | sed "s/. /&'/g" | sed "s/ /,&/g" | sed "s/\r$/'/g" | sed "s/^/&'/g" | sed "s//null/g"
I had to add ' behind and infront of every character and then the empty spaces that were I replaced with the word null
cat application.txt | sed "s/ *//g" | sed "s/\t/ /g" | sed "s/ /' /g" | sed "s/. /&'/g" | sed "s/ /,&/g" | sed "s/\r$/');/g" | sed "s/^/&'/g" | sed "s//null/g" |sed "s/^/insert into Application(ApplNo, ApplType, SponsorApplicant, MostRecentLabelAvailableFlag, CurrentPatentFlag, ActionType, Chemical_Type, Ther_Potential, Orphan_Code) values (/g" | sed "1D" > ~/public_html/application.sql.txt
This should give the proper syntax for adding from the database the SQL
Class Journals
Weekly Assignments
Personal Journal
Electronic Notes (E-notes)
Week 6 E-notes Eyanosch
Class (personal) Notes