*I removed the first row (column labels) and replaced all of the ''tabs'' with commas; I also turned the extra commas into null values: <code>cat Product.txt | sed "1D" | sed "s/\t/,/g" | sed "s/,,/,null,/g"</code>
 
*I removed the first row (column labels) and replaced all of the ''tabs'' with commas; I also turned the extra commas into null values: <code>cat Product.txt | sed "1D" | sed "s/\t/,/g" | sed "s/,,/,null,/g"</code>
 
*I began placing the apostrophes around the ''varchar'' data with the ''Form'', ''Dosage'', and ''TECode'' data. I placed apostrophes around this data by adding several <code>sed</code> replacements to the pipeline made earlier: <code>sed "s/,/&'/2" | sed "s/,/'&/3" | sed "s/,/&'/3" | sed "s/,/'&/4" | sed "s/,/&'/5" | sed "s/,/'&/6"</code>
 
*I began placing the apostrophes around the ''varchar'' data with the ''Form'', ''Dosage'', and ''TECode'' data. I placed apostrophes around this data by adding several <code>sed</code> replacements to the pipeline made earlier: <code>sed "s/,/&'/2" | sed "s/,/'&/3" | sed "s/,/&'/3" | sed "s/,/'&/4" | sed "s/,/&'/5" | sed "s/,/'&/6"</code>
*I noticed that there are a few commas and apostrophes in the raw data, I decided to initially replace the commas with characters that are not present elsewhere in the raw data (such as''~''); <code>sed "s/,/~/g"</code> was added to the beginning of the command chain to initially replace them, and <code>sed "s/~/,/g"</code> was added to the end of chain in order to restore them. The presence of apostrophes in the data was fixed by through adding <code>sed "s/'/''/g"</code> to the beginning of the pipe (this addition allows pgSQL to understand that these apostrophes are a part of the actual data.
+
*I noticed that there are a few commas and apostrophes in the raw data, I decided to initially replace the commas with characters that are not present elsewhere in the raw data (such as''~''); <code>sed "s/,/~/g"</code> was added to the beginning of the command chain to initially replace them, and <code>sed "s/~/,/g"</code> was added to the end of chain in order to restore them. The presence of apostrophes in the data was fixed by through adding <code><nowiki>sed "s/'/''/g"</nowiki></code> to the beginning of the pipe (this addition allows pgSQL to understand that these apostrophes are a part of the actual data.
 
*I placed apostrophes around all remaining ''varchar'' data by adding <code>sed "s/,/&'/7" | sed "s/,/'&/8" | sed "s/,/&'/8" | sed "s/\r$/'/g"</code> to the pipeline
 
*I placed apostrophes around all remaining ''varchar'' data by adding <code>sed "s/,/&'/7" | sed "s/,/'&/8" | sed "s/,/&'/8" | sed "s/\r$/'/g"</code> to the pipeline
 
*To the end of the current pipeline, I added <code>sed "s/^/insert into products(ApplNo,ProductNo,Form,Dosage,ProductMktStatus,TECode,ReferenceDrug,drugname,activeingred) values(/g" | sed "s/$/);/g"</code> to wrap up the formatting of the raw data (should now be usable as sequences of SQL <code>insert</code> statements)
 
*To the end of the current pipeline, I added <code>sed "s/^/insert into products(ApplNo,ProductNo,Form,Dosage,ProductMktStatus,TECode,ReferenceDrug,drugname,activeingred) values(/g" | sed "s/$/);/g"</code> to wrap up the formatting of the raw data (should now be usable as sequences of SQL <code>insert</code> statements)
Exception encountered, of type "Error"
[72ecf47b] /biodb/fall2015/index.php?diff=2609&oldid=2554&title=Blitvak_Week_6 Error from line 434 of /apps/xmlpipedb/biodb/fall2015/includes/diff/DairikiDiff.php: Call to undefined function each()
Backtrace:
#0 /apps/xmlpipedb/biodb/fall2015/includes/diff/DairikiDiff.php(544): DiffEngine->diag()
#1 /apps/xmlpipedb/biodb/fall2015/includes/diff/DairikiDiff.php(344): DiffEngine->compareSeq()
#2 /apps/xmlpipedb/biodb/fall2015/includes/diff/DairikiDiff.php(227): DiffEngine->diffLocal()
#3 /apps/xmlpipedb/biodb/fall2015/includes/diff/DairikiDiff.php(721): DiffEngine->diff()
#4 /apps/xmlpipedb/biodb/fall2015/includes/diff/DairikiDiff.php(859): Diff->__construct()
#5 /apps/xmlpipedb/biodb/fall2015/includes/diff/DairikiDiff.php(980): MappedDiff->__construct()
#6 /apps/xmlpipedb/biodb/fall2015/includes/diff/TableDiffFormatter.php(194): WordLevelDiff->__construct()
#7 /apps/xmlpipedb/biodb/fall2015/includes/diff/DiffFormatter.php(140): TableDiffFormatter->changed()
#8 /apps/xmlpipedb/biodb/fall2015/includes/diff/DiffFormatter.php(82): DiffFormatter->block()
#9 /apps/xmlpipedb/biodb/fall2015/includes/diff/DifferenceEngine.php(888): DiffFormatter->format()
#10 /apps/xmlpipedb/biodb/fall2015/includes/diff/DifferenceEngine.php(802): DifferenceEngine->generateTextDiffBody()
#11 /apps/xmlpipedb/biodb/fall2015/includes/diff/DifferenceEngine.php(733): DifferenceEngine->generateContentDiffBody()
#12 /apps/xmlpipedb/biodb/fall2015/includes/diff/DifferenceEngine.php(662): DifferenceEngine->getDiffBody()
#13 /apps/xmlpipedb/biodb/fall2015/includes/diff/DifferenceEngine.php(632): DifferenceEngine->getDiff()
#14 /apps/xmlpipedb/biodb/fall2015/includes/diff/DifferenceEngine.php(453): DifferenceEngine->showDiff()
#15 /apps/xmlpipedb/biodb/fall2015/includes/page/Article.php(795): DifferenceEngine->showDiffPage()
#16 /apps/xmlpipedb/biodb/fall2015/includes/page/Article.php(506): Article->showDiffPage()
#17 /apps/xmlpipedb/biodb/fall2015/includes/actions/ViewAction.php(44): Article->view()
#18 /apps/xmlpipedb/biodb/fall2015/includes/MediaWiki.php(395): ViewAction->show()
#19 /apps/xmlpipedb/biodb/fall2015/includes/MediaWiki.php(273): MediaWiki->performAction()
#20 /apps/xmlpipedb/biodb/fall2015/includes/MediaWiki.php(566): MediaWiki->performRequest()
#21 /apps/xmlpipedb/biodb/fall2015/includes/MediaWiki.php(414): MediaWiki->main()
#22 /apps/xmlpipedb/biodb/fall2015/index.php(44): MediaWiki->run()
#23 {main}