Search found 250 matches

by goodywp
22 Mar 2018 08:15
Forum: DOS Batch Forum
Topic: How to separate long string with multiple quotations into multiple lines for each substring inside each quotation..
Replies: 8
Views: 5927

Re: How to separate long string with multiple quotations into multiple lines for each substring inside each quotation..

Thank you so much for all the input.... I would like to use @Echo Off For /F "UseBackQ Delims=" %%A In ("fdata1.txt") Do Call :EachLine %%A Exit /B :EachLine For %%A In (%*) Do (Set /P "=%%~A"<Nul&Echo=)>>"echo_data_1.txt" GoTo :EOF The reason I choose this one is that after processing, the ```` has...
by goodywp
21 Mar 2018 15:14
Forum: DOS Batch Forum
Topic: How to separate long string with multiple quotations into multiple lines for each substring inside each quotation..
Replies: 8
Views: 5927

Re: How to separate long string with multiple quotations into multiple lines for each substring inside each quotation..

I don't see why you would call to another function instead of just using echo to output the variables inside the FOR command. You will need to provide better examples of when it works and when it fails. We have no insight otherwise. You do need an exit or GOTO :EOF after your FOR and before your la...
by goodywp
21 Mar 2018 14:20
Forum: DOS Batch Forum
Topic: How to separate long string with multiple quotations into multiple lines for each substring inside each quotation..
Replies: 8
Views: 5927

How to separate long string with multiple quotations into multiple lines for each substring inside each quotation..

Hi all, I have an long string in a text file as below: "12345", "23456-1w3s", "abas-122", "9876-ads", "alfsajf;lda" Now my task is to separate it into multiple lines based on the quotation in an another text file as below: "12345" "23456-1w3s" "abas-122" "9876-ads" "alfsajf;lda" I tired as be low co...
by goodywp
19 Mar 2018 08:59
Forum: DOS Batch Forum
Topic: Is any way to insert blank lines in the text file?
Replies: 4
Views: 4516

Re: Is any way to insert blank lines in the text file?

Thank you both Compo and elzooilogico!!! it works perfectly!!! appreciated.
by goodywp
13 Mar 2018 16:09
Forum: DOS Batch Forum
Topic: Is any way to insert blank lines in the text file?
Replies: 4
Views: 4516

Re: Is any way to insert blank lines in the text file?

I did try the post suggested and not work as expected. And today I found that post has been withdrawn..
by goodywp
12 Mar 2018 15:00
Forum: DOS Batch Forum
Topic: Is any way to insert blank lines in the text file?
Replies: 4
Views: 4516

Is any way to insert blank lines in the text file?

Hi, I have a txt file and need to replace some txt for updating. ....... set oldgen=%oldgen: =% set newgen=%newgen: =% @echo off &setlocal set "search=%oldgen%" set "replace=%newgen%" set "textfile=Readme-how-to-use-this-package.txt" set "newfile=indesnew.txt" (for /f "delims=" %%i in (%textfile%) d...
by goodywp
12 Mar 2018 12:12
Forum: DOS Batch Forum
Topic: What is the best way to extract a substring within a longer string?
Replies: 2
Views: 2764

Re: What is the best way to extract a substring within a longer string?

Squashman wrote:
09 Mar 2018 16:05
FOR /F command and use the DELIMS option. Use the <> as the delimiters.
You were shown how to use the TOKENS and DELIMS options in this post.
Thank you and get what wanted:

Code: Select all

FOR /F "tokens=2,3 delims=<>" %%A IN (scheme_source.txt) DO @echo %%A>>scheme_target.txt
by goodywp
09 Mar 2018 15:58
Forum: DOS Batch Forum
Topic: What is the best way to extract a substring within a longer string?
Replies: 2
Views: 2764

What is the best way to extract a substring within a longer string?

Hi all, I just got a new task. It is to extract a substring within the longer string. Here is the example, "Schemes are embedded as those scheme packs as <T501-08815-0103> in 'Schemes to Sign_for_829501.doc'" The task is to get substring T501-08815-0103 the variation is this < > can be two as <T501-...
by goodywp
01 Feb 2018 12:44
Forum: DOS Batch Forum
Topic: Can batch file itself have sed like function?
Replies: 2
Views: 3925

Can batch file itself have sed like function?

Hi All, I had one piece code which used sed in batch file. Now due to sed is not a native utilities in windows. When I implement my code in Windows server 2012 R2, I got this issue: 'sed' is not recognized as an internal or external command. I know there is two options: either I install sed utility ...
by goodywp
31 Jan 2018 10:05
Forum: DOS Batch Forum
Topic: run scripts on Windows 7 and Windows server 2012 R2
Replies: 4
Views: 4088

Re: run scripts on Windows 7 and Windows server 2012 R2

elzooilogico wrote:
30 Jan 2018 10:50
this or this may help
Very helpful... :D
Thanks elzooilogico !
by goodywp
30 Jan 2018 09:32
Forum: DOS Batch Forum
Topic: run scripts on Windows 7 and Windows server 2012 R2
Replies: 4
Views: 4088

Re: run scripts on Windows 7 and Windows server 2012 R2

Those numbers are the Windows Kernel versions. Not the version of DOS you are using. DOS died before the turn of the century. CMD.exe works the same on Windows 7 and Windows 2012 Server. Permission is permissions and has nothing to do with the batch file itself. Thank you and I would like to know i...
by goodywp
29 Jan 2018 15:19
Forum: DOS Batch Forum
Topic: run scripts on Windows 7 and Windows server 2012 R2
Replies: 4
Views: 4088

run scripts on Windows 7 and Windows server 2012 R2

Hi all, I have done the scripts in Windows 7 and DOS version 6.1.7601 and tested them successfully. Now I was asked to run it on the server, Server 2012 R2, DOS version 6.3.9600 Even I had login as administrator in both Windows 7 and Server 2012 R2, it runs pretty well and smooth in Windows 7, Howev...
by goodywp
27 Jan 2018 07:13
Forum: DOS Batch Forum
Topic: how to read from a txt file and process then write into a txt file
Replies: 4
Views: 3690

Re: how to read from a txt file and process then write into a txt file

So what is stopping you from using a FOR /F command to read the file. Then use the IF command to see if the line equals what you are checking. Then do something based on that statement being TRUE. You have been shown all of this in your previous questions over the past 6 months. Could you please re...
by goodywp
26 Jan 2018 15:51
Forum: DOS Batch Forum
Topic: how to read from a txt file and process then write into a txt file
Replies: 4
Views: 3690

Re: how to read and process then write into a txt file from a text file with some strings

I guess I would go back and look at the code that was creating that file and figure out what is coded incorrectly, that is causing ECHO OFF to get output to your file. Actually, it is due to some lines (variable) empty, originally I added into the source file. but as requirement, it is better hidde...