{"id":33021,"date":"2017-09-21T03:01:25","date_gmt":"2017-09-20T17:01:25","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=33021"},"modified":"2017-09-21T07:10:01","modified_gmt":"2017-09-20T21:10:01","slug":"spreadsheet-and-xml-global-substitution-accountability-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/spreadsheet-and-xml-global-substitution-accountability-tutorial\/","title":{"rendered":"Spreadsheet and XML Global Substitution Accountability Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/global_substitution.pdf\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Spreadsheet and XML Global Substitution Accountability Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/gs_566of.jpg\" title=\"Spreadsheet and XML Global Substitution Accountability Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Spreadsheet and XML Global Substitution Accountability Tutorial<\/p><\/div>\n<p>Today we address some accountability improvements to the XML Global Substitution web application we last left off with at <a title='Spreadsheet and XML Global Substitution Genericization Tutorial' href='#sxmlgsgt'>Spreadsheet and XML Global Substitution Genericization Tutorial<\/a>.  You may recall, then, that we had a two step procedure of &#8230;<\/p>\n<ol>\n<li>From filespec create CSV mapping (global_substitution.csv) for second part via section tags containing role=&#8221;paragraph&#8221; and old_label=&#8221;[OldLabel]&#8221; and label=&#8221;[NewLabel]&#8221; all before section tag end<\/li>\n<li>From input index file and CSV above create Korn Shell (ksh) file that runs &#8230; ksh -x global_substitution.ksh &#8230; to update for new index file (but backup yourself first)<\/li>\n<\/ol>\n<p> &#8230; where, if that sounds a bit new to you, that is because we bit the bullet, and renamed the web application with the more apt name &#8220;global_substitution&#8221; wherever, earlier on, we had the name &#8220;tr_mapping&#8221;.  And this is a fairly big topic regarding &#8220;accountability&#8221;.   To us, &#8220;accountability&#8221; is mainly about being able to revisit some software, work out what it does, and be confident to use it when and if and how it is applicable to an issue you have and\/or a job you want done.<\/p>\n<p>&#8220;Accountability&#8221; with respect to any application goes hand in hand with listening to the client as to how their life can be made easier because of your application&#8217;s workings.  With our XML &#8220;global substitution&#8221; work we&#8217;ve had quite a few user driven changes of recent times, and we decided to assemble them into a blog posting today.  First off, what files are involved as inputs, where <b>bold<\/b> parts are new since that last incarnation &#8230;<\/p>\n<ul>\n<li>&#8220;Filespec files&#8221;: File specification for input XML data files &#8230; whose data can be used to populate CSV and KSH files<\/li>\n<li>&#8220;Index file&#8221;: File name for input (and output) index XML file<\/li>\n<li>&#8220;CSV file&#8221;: This file, previously, was mainly thought of as an intermediate or output file, but <b>today we focus more on it being an input file<\/b> &#8230; to quote the code today &#8230;<br \/>\n<blockquote><p>\nAllow for jobs where supplied with index file and intermediate CSV and a &#8220;halfway prefix&#8221; to search for in CSV file, but no KSH file yet\n<\/p><\/blockquote>\n<\/li>\n<\/ul>\n<p>And what are the intermediate and\/or output files?<\/p>\n<ul>\n<li>&#8220;CSV file&#8221;: as mentioned above<\/li>\n<li>&#8220;KSH file&#8221;: Our Korn Shell scripting &#8220;Index file&#8221; amender is created via &#8220;Filespec files&#8221; processing <b>or, as of today, via reading the &#8220;CSV File&#8221; as an input file &#8230; and now we encourage its use more often to improve the reporting functionality talked about below<\/b><\/li>\n<li>&#8220;HTML file&#8221;: <b>COM_.htm report file using the talents of the HTML <i>div<\/i> element<\/b> (remember <a target=_blank title='HTML Textarea and Div Talents Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/html-textarea-and-div-talents-primer-tutorial\/'>HTML Textarea and Div Talents Primer Tutorial<\/a>?)<\/li>\n<li>&#8220;TXT file&#8221;: <b>New &#8220;sanity check&#8221; extracting files of contents of optionally designated tag of interest<\/b><\/li>\n<li>&#8220;Index file&#8221;: File name for input (and output) index XML file<\/li>\n<\/ul>\n<p>Sound a bit familiar?  Well, yes, remember with <a target=_blank title='XML Subtraction and Addition Genericization Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/xml-subtraction-and-addition-genericization-tutorial\/'>XML Subtraction and Addition Genericization Tutorial<\/a> how we said &#8230;<\/p>\n<blockquote cite='https:\/\/www.rjmprogramming.com.au\/ITblog\/xml-subtraction-and-addition-genericization-tutorial\/'>\n<p>Both above were challenging, and with the second we were glad we could call on &#8230;<\/p>\n<p><\/p>\n<ul>\n<li><a target=_blank title='HTML Textarea and Div Talents Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/html-textarea-and-div-talents-primer-tutorial\/'>HTML Textarea and Div Talents Primer Tutorial<\/a> proved, at least to us, that HTML <a target=_blank title='HTML div tag information from w3schools' href='http:\/\/www.w3schools.com\/tags\/tag_div.asp'><i>div<\/i><\/a> elements had to be involved in some way shape or form &#8230; along with the web application user experience (<a target=_blank title='UX information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/User_experience'>UX<\/a>) thoughts of &#8230;<\/li>\n<li><a target=_blank title='HTML5 Details Summary Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/html5-details-summary-primer-tutorial\/'>HTML5 Details Summary Primer Tutorial<\/a> taught us, recently, about a great new HTML5 <a target=_blank title='blank title='Reveal tutorials here' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/reveal'>reveal<\/a> CSS styling idea<\/li>\n<\/ul>\n<\/blockquote>\n<p> &#8230; and we also call on the HTML <i>textarea<\/i> element for improvements today.<\/p>\n<p>Have been told that those &#8220;HTML file&#8221; and &#8220;TXT file&#8221; <i>seal the deal<\/i> as far as &#8220;feeling good&#8221; regarding the data, which is important, of course.<\/p>\n<p>Another user driven improvement with the &#8220;Filespec files&#8221; processing (to create that &#8220;CSV file&#8221;) we add more data intelligence via &#8230;<\/p>\n<ol>\n<li>optional &#8220;Filespec files&#8221; first <i>label<\/i> in the &#8220;CSV file&#8221; first column via new &#8220;New label regarding global substitutions start delimitation&#8221; [ uci=&#8221;] and &#8220;New label regarding global substitutions end delimitation&#8221; [&#8220;]<\/li>\n<li>optional &#8220;Filespec files&#8221; <i>title<\/i> in the &#8220;CSV file&#8221; last column via new &#8220;After Find Title (CSV last field) tag prefix&#8221; [&gt;] and &#8221; After Find Title (CSV last field) tag suffix [&lt;\/title&gt;]<\/li>\n<\/ol>\n<p>A couple of new options that you might expect as an HTML input type=checkbox element are, instead, today, handled by clicking a link for those decisions &#8230;<\/p>\n<ul>\n<li>if &#8220;KSH file&#8221; exists ahead of a &#8230;<br \/>\n<blockquote><p>\nAllow for jobs where supplied with index file and intermediate CSV and a &#8220;halfway prefix&#8221; to search for in CSV file, but no KSH file yet\n<\/p><\/blockquote>\n<p> &#8230; type of execution, we allow the user to delete that &#8220;KSH file&#8221; ahead of the run\n<\/li>\n<li>we used to demand the existence of both <i>oldlabel<\/i> and <i>label<\/i> attributes &#8230; but we allow for just <i>label<\/i> existant data as the default but if the user does not like this idea, they can go back to the original idea that both <i>oldlabel<\/i> and <i>label<\/i> have to exist in the XML data<\/li>\n<\/ul>\n<p>All very &#8220;business logic&#8221; feeling, but there you are, businesses know the way they want the data to work for them.<\/p>\n<p>Here are the downloadable PHP <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/global_substitution.php--GETME\" title=\"global_substitution.php\">global_substitution.php<\/a> (changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/global_substitution.php--GETME\" title=\"global_substitution.php\">this way<\/a> based on that previous tr_mapping.php incarnation).  Maybe you can adapt it to something you are working at with XML data, and you can see us using it with today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/global_substitution.pdf\" title=\"Click picture\">PDF slideshow<\/a> presentation?<\/p>\n<hr>\n<p id='sxmlgsgt'>Previous relevant <a target=_blank title='Spreadsheet and XML Global Substitution Genericization Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/spreadsheet-and-xml-global-substitution-genericization-tutorial\/'>Spreadsheet and XML Global Substitution Genericization Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/tr_mapping_more.jpg\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Spreadsheet and XML Global Substitution Genericization Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/tr_mapping_more.jpg\" title=\"Spreadsheet and XML Global Substitution Genericization Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Spreadsheet and XML Global Substitution Genericization Tutorial<\/p><\/div>\n<p>It&#8217;s one thing to write a useful one off web application with quite a few hard codings, but what about an attempt to genericize it, and by so doing, oftentimes you are improving its documentation aspects, so that, if the code is revisited years later &#8230;<\/p>\n<ul>\n<li>its generic qualities will be plain to all &#8230; and at the same time &#8230;<\/li>\n<li>it will be far easier to imagine as far as inputs are concerned &#8230;<\/li>\n<li>the user can (still) break the job up<\/li>\n<li>the user has less to worry about as far as a backup of data goes<\/li>\n<li>it does not feel like a one off any more<\/li>\n<li>it is less likely to be ill used for an inapplicable application<\/li>\n<\/ul>\n<p> &#8230; so that, all in all, we feel much more confident such code can last the test of time and usefulness into the future than yesterday&#8217;s (albeit useful) one off feeling version of the code you can see at <a title='Spreadsheet and XML Global Substitution CSV Tutorial' href='#saxgsct'>Spreadsheet and XML Global Substitution CSV Tutorial<\/a> as shown below.<\/p>\n<p>What&#8217;s the main driver of genericization, in our book (<font size=1>but not our pamphlettes<\/font>) for small jobs?<\/p>\n<ol>\n<li>turn all hardcodings you can into parameterizable variables, and today that is via PHP $_GET[] variables off the web browser address bar<\/li>\n<li>allow the user to change these, as the hardcodings just become defaults, and are presented in a submittable HTML form whose action is to recall the same piece of PHP software (code)<\/li>\n<\/ol>\n<p> &#8230; simple, huh?!<\/p>\n<p>Again, you can see the various aspects of this, in play, with today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/tr_mapping_more.jpg\" title=\"Tutorial picture\">tutorial picture<\/a>, and though it is not much use to run the PHP code live, its style is far more generic now, so we want to share <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/tr_mapping.php-GETME\" title=\"tr_mapping.php\">tr_mapping.php<\/a> (changed <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/PHP\/tr_mapping.php-GETME\" title=\"tr_mapping.php\">this way<\/a>) with you for your perusal &#8230; just in case (it is of use for you).<\/p>\n<hr>\n<p id='saxgsct'>Previous relevant <a target=_blank title='Spreadsheet and XML Global Substitution CSV Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/spreadsheet-and-xml-global-substitution-csv-tutorial\/'>Spreadsheet and XML Global Substitution CSV Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/tr_mapping.jpg\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Spreadsheet and XML Global Substitution CSV Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/tr_mapping.jpg\" title=\"Spreadsheet and XML Global Substitution CSV Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Spreadsheet and XML Global Substitution CSV Tutorial<\/p><\/div>\n<p>Programmatically, we came in half way with the programming when we presented <a title='Spreadsheet and XML Global Substitution Primer Tutorial' href='#saxgspt'>Spreadsheet and XML Global Substitution Primer Tutorial<\/a> as shown below.  The programming, then, had two inputs, namely &#8230;<\/p>\n<ol>\n<li>input spreadsheet&#8217;s CSV file <i>manually created<\/i><\/li>\n<li>index XML file<\/li>\n<\/ol>\n<p> &#8230; but that CSV file can be <i>programmatically created<\/i> rather than <i>manually created<\/i>.  And while we&#8217;re at <i>programmatically creating<\/i> the CSV we could also <i>programmatically create<\/i> the Korn Shell (ksh) easier there too, with the same program, rather than using TextWrangler&#8217;s Grep (RegEx) talents &#8230; not that we&#8217;re ungrateful or anything &#8230; but it is good to mix things up to improve procedures sometimes.<\/p>\n<p>And what programming language can we use, and what environment for that programming code?  We think &#8230;<\/p>\n<ul>\n<li>coding wise, we&#8217;ll use PHP (starring PHP&#8217;s <a target=_blank title='PHP glob() method information' href='http:\/\/php.net\/manual\/en\/function.glob.php'>glob()<\/a> method) &#8230; and the environment for that will be that &#8230;<\/li>\n<li>we&#8217;ll use a (local Apache\/PHP\/MySql web server) <a target=_blank title='MAMP local web server' href='http:\/\/mamp.info'>MAMP<\/a> subfolder (ie. how desktop application &#8220;can meet&#8221; web application) off its Document Root (\/Applications\/MAMP\/htdocs\/) &#8230; \/Applications\/MAMP\/htdocs\/tr_mapping\/ &#8230; to store the XML data files (no CSV needed as input this way, as it will be <i>programmatically created<\/i> in part 1 of 2 parts to the whole job) &#8230; which becomes accessible in two ways &#8230;\n<ol>\n<li><i>http:\/\/localhost:8888\/tr_mapping\/tr_mapping.php<\/i>#in_a_web_browser<\/li>\n<li>at Mac OS X Terminal desktop application command line via &#8230; <br \/><i>cd \/Applications\/MAMP\/htdocs\/tr_mapping<\/i><br \/><i>ksh -x tr_mapping.ksh<\/i><\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p>Again, email is the conduit for both sides of &#8230;<\/p>\n<ol>\n<li>input in<\/li>\n<li>output out<\/li>\n<\/ol>\n<p> &#8230; to complete proceedings.  You can see the various aspects of this, in play, with today&#8217;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/tr_mapping.jpg\" title=\"Tutorial picture\">tutorial picture<\/a>, and though it is not much use to run the PHP code live, its style is leaning towards the generic side enough for us to want to share <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/tr_mapping.php_GETME\" title=\"tr_mapping.php\">tr_mapping.php<\/a> with you for your perusal &#8230; just in case (it is of use for you).<\/p>\n<hr>\n<p id='saxgspt'>Previous relevant <a target=_blank title='Spreadsheet and XML Global Substitution Primer Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/spreadsheet-and-xml-global-substitution-primer-tutorial\/'>Spreadsheet and XML Global Substitution Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/XML\/spreadsheet_xml_job.pdf\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Spreadsheet and XML Global Substitution Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/XML\/spreadsheet_xml_job-224of.jpg\" title=\"Spreadsheet and XML Global Substitution Primer Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Spreadsheet and XML Global Substitution Primer Tutorial<\/p><\/div>\n<p>Yesterday when we were discussing <a target=_blank title='Worldbank API World Country Reporting Regex Tutorial' href='https:\/\/www.rjmprogramming.com.au\/ITblog\/worldbank-api-world-country-reporting-regex-tutorial\/'>Worldbank API World Country Reporting Regex Tutorial<\/a> we mentioned &#8230;<\/p>\n<blockquote>\n<p> &#8230; and we use <strike>it<\/strike> (ie. Regex) with serverside PHP today, under the auspices of the <a target=_blank title='PHP regex' href='http:\/\/php.net\/manual\/en\/function.preg-match.php'>preg_match<\/a> function, though we most often use RegEx thinking with the Javascript <a target=_blank title='Javascript string replace function information from w3schools' href='http:\/\/www.w3schools.com\/jsref\/jsref_replace.asp'><i>replace<\/i><\/a> function, as the way to make substitutions for more than one occurrence, (the one occurrence design being) a default &#8220;curiosity&#8221; (but can be useful too) about Javascript&#8217;s version of substitution.  You may know this RegEx usage of the Javascript replace function as &#8220;global substitution&#8221;.<\/p>\n<\/blockquote>\n<p> &#8230; and that term &#8220;global substitution&#8221;.  Many editing jobs, especially text file based ones, require or benefit from &#8220;global substitution&#8221; carefully applied, that is.  It is common to see an editor who shies away from &#8220;global substitution&#8221; methods, and in many cases that is wise, but &#8220;global substitution&#8221; gets good results when you &#8230;<\/p>\n<ul>\n<li>substitute things you know exist in the precise form you intend to search for, and only there, where you want to replace &#8230; to <\/li>\n<li>replacements should not feed back into the substitution list &#8230; doh &#8230; or you will end up with a confused unintended result<\/li>\n<\/ul>\n<p>In real life, it is often the case that the conditions above are easy to obey, because you are mapping an old numbering and\/or naming system to a completely new and dissimilar numbering and\/or naming system.  That&#8217;s the case in a little job we drilled down into, to show you what we did, that involved RegEx thoughts, to solve a problem.<\/p>\n<p>So, with our job we had &#8230;<\/p>\n<ul>\n<li>Aim: Change some XML in one file to have the text in one column of a Spreadsheet be mapped to the contents of another column of that same Spreadsheet<\/li>\n<li>Inputs: Excel Spreadsheet with those two columns as mentioned above and the one input XML file<\/li>\n<li>From the User: Asked for the user to send the Excel Spreadsheet &#8230; Saved As Comma Separated Values (CSV) in MS-DOS format and the one input XML file as two attached files in an Email<\/li>\n<li>Processing:\n<ol>\n<li>Opened Email with <a target=_blank title='Gmail' href='http:\/\/gmail.com'>Gmail<\/a> web application in Safari web browser desktop application, on a MacBook Pro laptop<\/li>\n<li>Downloaded the two Attachments and copied over to where we like to work &#8230; the home of <a target=_blank title='MAMP' href='http:\/\/mamp.info'>MAMP<\/a> local Apache\/PHP\/MySql web server &#8230; on a Mac OS X system is <i>\/Applications\/MAMP\/htdocs<\/i> (which we&#8217;ll access later with the Mac OS X <i>Terminal<\/i> desktop application later via &#8220;cd \/Applications\/MAMP\/htdocs&#8221;)<\/li>\n<li>Opened our favourite Text Editor desktop application, called <a target=_blank href='http:\/\/www.macupdate.com\/app\/mac\/11009\/textwrangler' title='Mac TextWrangler text editor'><i>TextWrangler<\/i><\/a>, whose &#8220;Find and Replace&#8221; &#8220;Grep&#8221; suboption will be a feature of today&#8217;s solution<\/li>\n<li>File -&gt; Open the Spreadsheet CSV file<\/li>\n<li>Search -&gt; Find&#8230; &#8230; Matching Mode: <a target=_blank title='Linux grep command information from computerhope' href='http:\/\/www.computerhope.com\/unix\/ugrep.htm'>Grep<\/a> &#8230; Find: ^ Replace: #  &#8230; Replace All &#8230; remember our &#8220;RegEx&#8221; &#8220;cheat sheet&#8221; discussion (lots of which is relevant to TextWrangler <i>Matching Mode: Grep<\/i> as well) at that aforesaid mentioned tutorial &#8230;<br \/>\n<blockquote>\n<ul>\n<li>^ can mean &#8220;start of&#8221;<\/li>\n<li>$ can mean &#8220;end of&#8221;<\/li>\n<li>. can sometimes mean &#8220;one existant character wildcard&#8221; &#8230; or sometimes it is % or ? for this in other &#8220;systems&#8221;<\/li>\n<li>* can often mean &#8220;zero or more of preceding character wildcard&#8221;<\/li>\n<li>[] and () bracketing rules are pretty crucial for the more esoteric usages &#8230; also study | usage<\/li>\n<\/ul>\n<\/blockquote>\n<p>? &#8230; well, we want to start out mapping all lines to non-acting <a target=_blank title='korn' href='http:\/\/www.computerhope.com\/unix\/uksh.htm'>Korn Shell<\/a> command lines<\/li>\n<li>Typed as the new top line <i>#!\/bin\/ksh<\/i> &#8230; just for completeness sake &#8230; is optional step<\/li>\n<li>Search -&gt; Find&#8230; &#8230; No Matching Mode &#8230; Find: #,[ Replace: <a target=_blank title='Linux cat command information from computerhope' href='http:\/\/www.computerhope.com\/unix\/ucat.htm'>cat<\/a> COMM.MIL~INDEX.xml | <a target=_blank title='Linux sed command information from computerhope' href='http:\/\/www.computerhope.com\/unix\/used.htm'>sed<\/a> &#8216;\/\\[    &#8230; Replace All<\/li>\n<li>Search -&gt; Find&#8230; &#8230; Matching Mode: Grep &#8230; Find: ]$ Replace: \\\\]\/g&#8217; > x.xxx ; cat x.xxx > COMM.MIL~INDEX.xml ; <a target=_blank title='Linux rm command information from computerhope' href='http:\/\/www.computerhope.com\/unix\/urm.htm'>rm<\/a> -f x.xxx    &#8230; Replace All<\/li>\n<li>File -&gt; Save As&#8230; fix_csv.ksh (to \/Applications\/MAMP\/htdocs directory)<\/li>\n<\/ol>\n<li>Opened Terminal desktop application that has a default <a target=_blank title='bash' href='http:\/\/www.computerhope.com\/unix\/ubash.htm'>Bash<\/a> environment (a lot like Linux, but is (giving you access to) a Mac OS X BSD operating system, really)<\/li>\n<li>Typed in: <i>cd \/Applications\/MAMP\/htdocs<\/i>  # to get to data<\/li>\n<li>Typed in: <i>cp COMM.MIL~INDEX.xml COMM.MIL~INDEX_original.xml<\/i>  # to backup data ahead of processing, as well as to compare file sizes with later, as a sanity check<\/li>\n<li>Typed in: <i>ksh -x fix_csv.ksh<\/i>  # access Korn Shell interpreter and run the TextWrangler created Korn Shell Script (and the -x <i>switch<\/i> tells the interpreter to be verbose with output reporting)<\/li>\n<li>Typed in: <i>ls -l COMM.MIL~INDEX*.xml<\/i>  # first sanity check verified files different, and not disastrously so &#8230; good first sign<\/li>\n<li>Typed in: <i>fgrep -c &#8216;[S1.12.4.20]&#8217; COMM.MIL~INDEX*.xml ; fgrep -c &#8216;[CCR.28E.20]&#8217; COMM.MIL~INDEX*.xml<\/i>  # second sanity check to prove old\/new parts of first\/last relevant Spreadsheet CSV file records were correctly mapped &#8230; and they were &#8230; so<\/li>\n<li>Opened Email with <a target=_blank title='Gmail' href='http:\/\/gmail.com'>Gmail<\/a> web application in Safari web browser desktop application (and used &#8220;Forward&#8221; option, attaching that new XML file), on a MacBook Pro laptop &#8230; so that &#8230;<\/li>\n<\/ol>\n<li>Output: One XML file with the global substitutions expressed in the Excel Spreadsheet performed, returned to User via Email &#8220;Forward&#8221; option, attaching that new XML file<\/li>\n<\/ul>\n<p>We hope you can see the good use you can make with Email and a good Text Editor and Linux type shell scripting, influenced by <a target=_blank title='Linux RegEx' href='https:\/\/www.digitalocean.com\/community\/tutorials\/using-grep-regular-expressions-to-search-for-text-patterns-in-linux'>RegEx<\/a> pattern matching regarding &#8230;<\/p>\n<ul>\n<li><a target=_blank title='Linux grep command information from computerhope' href='http:\/\/www.computerhope.com\/unix\/ugrep.htm'>grep<\/a><\/li>\n<li><a target=_blank title='Linux sed command information from computerhope' href='http:\/\/www.computerhope.com\/unix\/used.htm'>sed<\/a><\/li>\n<\/ul>\n<p>Which leaves us with today&#8217;s PDF slideshow of snapshots of making this job work, <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/XML\/spreadsheet_xml_job.pdf\">here<\/a>.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d28426' onclick='var dv=document.getElementById(\"d28426\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/regex\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d28426' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d28733' onclick='var dv=document.getElementById(\"d28733\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/csv\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d28733' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d28771' onclick='var dv=document.getElementById(\"d28771\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/form\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d28771' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d33021' onclick='var dv=document.getElementById(\"d33021\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/xml\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d33021' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Today we address some accountability improvements to the XML Global Substitution web application we last left off with at Spreadsheet and XML Global Substitution Genericization Tutorial. You may recall, then, that we had a two step procedure of &#8230; From &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/spreadsheet-and-xml-global-substitution-accountability-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[2098,281,283,290,2310,342,452,576,578,677,932,997,1054,1262,1319,1348,1480],"class_list":["post-33021","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-accountability","tag-css","tag-csv","tag-data","tag-details","tag-div","tag-form","tag-html","tag-html5","tag-korn-shell","tag-php","tag-programming","tag-report","tag-textarea","tag-tutorial","tag-user-acceptance","tag-xml"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/33021"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=33021"}],"version-history":[{"count":13,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/33021\/revisions"}],"predecessor-version":[{"id":33040,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/33021\/revisions\/33040"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=33021"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=33021"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=33021"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}