

InterviewSolution
Saved Bookmarks
1. |
Solve : Find and Replace with a dynamic string search? |
Answer» <html><body><p>Quote from: BC_Programmer on December 24, 2010, 01:09:55 AM</p><blockquote>No. you said a "CSV Parsing Library". Now if you really meant a "text processing library that happens to include CSV parsing capabilities" then that would make a bit more sense. Generally when you have one library that does a single overly-concise task (such as CSV parsing) it often turns the whole thing into some kind of sick over-complicated joke. </blockquote> when i said a library, i meant things like the <a href="https://docs.python.org/library/csv.html">csv library</a> that comes with Python, or the <a href="http://search.cpan.org/~makamaka/Text-CSV-<klux>1</klux>.20/lib/Text/CSV.pm">Text:CSV</a> library for Perl. What kind of library do you think i am talking about? Quote from: Salmon Trout on December 24, 2010, 01:37:26 AM<blockquote>This is what he asked for. (Yes I know <a href="https://interviewquestions.tuteehub.com/tag/nt-572081" style="font-weight:bold;" target="_blank" title="Click to know more about NT">NT</a> family cmd is "not DOS").<br/><br/>Why is it that so many threads starting with requests of this nature get adorned with discussions of the type above?<br/></blockquote> I believe most who post here does not use DOS 6.22 any more, and there is no indication that OP wants it to be a PURE batch script, where you only can use what's provided by cmd.exe ( note, "PURE batch script" does not include external tools , even those installed by default).<br/>this is also called a DOS batch script. (note, the word PURE is omitted)<br/> Code: <a>[Select]</a>echo off<br/>......<br/>gawk -F'"' '{for(i=2;i<=NF;i+=2) gsub(",","",$i); }1' OFS='"' myfile > newfile<br/>move newfile myfile<br/>for %%a in ( 'cscript //nologo myscript.vbs' ) do (<br/> ...... <br/>)<br/>....<br/> Quote from: ghostdog74 on December 24, 2010, 05:41:20 PM<blockquote>(note, "PURE batch script" does not include external tools , even those installed by default).<br/>this is also called a DOS batch script. (note, the word PURE is omitted)<br/></blockquote> <br/>Tha... that doesn't even make sense... it's like saying a "pure instruction booklet does not contain instructions". I mean, I understand what you're saying, that a "Pure Batch script" only uses commands inherent to cmd.exe, but that sort of goes against the whole point of a "batch" script- a series of instructions. trying to add arbitrary separations of what constitutes "pure and unpure" is pointless. By that very definition no programming language is pure because they all call into the native libraries, somehow there is some ethereal distinction where you can use language <em>features</em> like C/C++ extern procedures and dll/.so importing in many others and your code is no longer "pure" but if you use functions of the language itself which call into those same OS specific features you're code is "unpure" I mean, yes, your code might be less portable, but less "pure"? That's rather silly.<br/><br/> Quote<blockquote>DOS batch script<br/></blockquote> a DOS batch script is simple. a batch file that runs on a standard DOS installation. Therefore you can use choice, fc, diskcomp, whatever. It's still a standard DOS installation and a "DOS batch script" would work just <a href="https://interviewquestions.tuteehub.com/tag/fine-248571" style="font-weight:bold;" target="_blank" title="Click to know more about FINE">FINE</a>. A "DOS Batch script" doesn't have to exclude uses of fc, diskcomp, find, more, sort, etc. to count. Of course about 90% of the time people seem to get this idea that, you know, despite it not being mentioned <em>anywhere</em> that the command prompt is DOS in the actual software, they think it's called DOS. "ohhh! black screen... white writing! OMG it must be DOS! it couldn't possibly be powershell or bash or any number of other applications and shells that display that exact same theme by default but operate entirely differently.<br/> Quote from: BC_Programmer on December 24, 2010, 06:09:37 PM<blockquote> but that sort of goes against the whole point of a "batch" script- a series of instructions. <br/></blockquote> No, that's exactly what i am trying to illustrate. a batch script is just a series of instructions to perform job, whether those instructions comes from internal shell or external tools doesn't matter. that said, what OP wants is just a series of commands in a batch file, so using gawk or any other external tools to perform the job is fine.! <br/> Quote<blockquote>That's rather silly<br/></blockquote> tell that to ST in post #14.<br/><br/> Quote<blockquote>trying to add arbitrary separations of what constitutes "pure and unpure" is pointless. By that very definition no programming language is pure because they all call into the native libraries, somehow there is some ethereal distinction where you can use language <em>features</em> like C/C++ extern procedures and dll/.so importing in many others and your code is no longer "pure" but if you use functions of the language itself which call into those same OS specific features you're code is "unpure" I mean, yes, your code might be less portable, but less "pure"? That's rather silly.<br/>a DOS batch script is simple. a batch file that runs on a standard DOS installation. Therefore you can use choice, fc, diskcomp, whatever. It's still a standard DOS installation and a "DOS batch script" would work just fine. A "DOS Batch script" doesn't have to exclude uses of fc, diskcomp, find, more, sort, etc. to count. Of course about 90% of the time people seem to get this idea that, you know, despite it not being mentioned <em>anywhere</em> that the command prompt is DOS in the actual software, they think it's called DOS. "ohhh! black screen... white writing! OMG it must be DOS! it couldn't possibly be powershell or bash or any number of other applications and shells that display that exact same theme by default but operate entirely differently.<br/></blockquote> useless babble, not going to bother with it. Quote from: ghostdog74 on December 24, 2010, 06:43:26 PM<blockquote>No, that's exactly what i am trying to illustrate. a batch script is just a series of instructions to perform job, whether those instructions comes from internal shell or external tools doesn't matter. that said, what OP wants is just a series of commands in a batch file, so using gawk or any other external tools to perform the job is fine.!<br/></blockquote> <br/><br/>ahh, so I can provide this as a solution:<br/><br/> Code: <a>[Select]</a>echo off<br/>csc /out:findrep.exe findrep.cs<br/>findrep %1 %2<br/><br/><br/> Quote from: BC_Programmer on December 24, 2010, 07:13:04 PM<blockquote><br/>ahh, so I can provide this as a solution:<br/><br/> Code: <a>[Select]</a>echo off<br/>csc /out:findrep.exe findrep.cs<br/>findrep %1 %2<br/><br/><br/></blockquote> why not? its perfectly fine if there's a c sharp <a href="https://interviewquestions.tuteehub.com/tag/compiler-925748" style="font-weight:bold;" target="_blank" title="Click to know more about COMPILER">COMPILER</a> installed. However, you don't want to do this because why would you want to compile it every time you run the batch ? Plus, if you were to distribute the batch, its dependent on whether a csc compiler is installed. Just compile it once, then distribute the exe will do. <br/></body></html> | |