InterviewSolution
 Saved Bookmarks
    				| 1. | 
                                    Solve : Find and Replace with a dynamic string search? | 
                            
| 
                                   
Answer»  Quote from: BC_Programmer on December 24, 2010, 01:09:55 AM 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.when i said a library, i meant things like the csv library that comes with Python, or the Text:CSV 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 This is what he asked for. (Yes I know NT family cmd is "not DOS").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). this is also called a DOS batch script. (note, the word PURE is omitted) Code: [Select]echo off ...... gawk -F'"' '{for(i=2;i<=NF;i+=2) gsub(",","",$i); }1' OFS='"' myfile > newfile move newfile myfile for %%a in ( 'cscript //nologo myscript.vbs' ) do ( ...... ) .... Quote from: ghostdog74 on December 24, 2010, 05:41:20 PM (note, "PURE batch script" does not include external tools , even those installed by default). 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 features 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. Quote DOS batch scripta 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 anywhere 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. Quote from: BC_Programmer on December 24, 2010, 06:09:37 PM but that sort of goes against the whole point of a "batch" script- a series of instructions.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.! Quote That's rather sillytell that to ST in post #14. Quote 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 features 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.useless babble, not going to bother with it. Quote from: ghostdog74 on December 24, 2010, 06:43:26 PM 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.! ahh, so I can provide this as a solution: Code: [Select]echo off csc /out:findrep.exe findrep.cs findrep %1 %2 Quote from: BC_Programmer on December 24, 2010, 07:13:04 PM why not? its perfectly fine if there's a c sharp COMPILER 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.  | 
                            |