Search found 189 matches

by goodywp
23 Nov 2018 16:12
Forum: DOS Batch Forum
Topic: How to cut some blocks off the entire file then save into separated file
Replies: 23
Views: 3313

Re: How to cut off some blocks off the entire file then save into separated file

I downloaded your sample, and I notice the file is using LF as line terminator but dos expects CRLF. So the lines are never terminated and cause the variable to overflow as it can only hold 8kb and your input is 12kb which I believe explains the data getting lost. Then this 8kb is treated as a sing...
by goodywp
23 Nov 2018 15:57
Forum: DOS Batch Forum
Topic: How to cut some blocks off the entire file then save into separated file
Replies: 23
Views: 3313

Re: How to cut off some blocks off the entire file then save into separated file

I downloaded your sample, and I notice the file is using LF as line terminator but dos expects CRLF. So the lines are never terminated and cause the variable to overflow as it can only hold 8kb and your input is 12kb which I believe explains the data getting lost. Then this 8kb is treated as a sing...
by goodywp
23 Nov 2018 13:36
Forum: DOS Batch Forum
Topic: How to cut some blocks off the entire file then save into separated file
Replies: 23
Views: 3313

Re: How to cut off some blocks off the entire file then save into separated file

I also used this site library function as below: @ECHO OFF REM.-- Prepare the Command Processor SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION echo.Extracting hello world block into "Load_NAR.M83" file call:extractFromFile ";---- NAR signed binaries" "DEVICE_ID.TXT">"Load_NAR.M83" ::-----...
by goodywp
23 Nov 2018 13:17
Forum: DOS Batch Forum
Topic: How to cut some blocks off the entire file then save into separated file
Replies: 23
Views: 3313

Re: How to cut off some blocks off the entire file then save into separated file

;---- NAR signed binaries -epackage ;---- Component: Tetra Admin Resources 0001 ;---- Catalog: TA_resources.mxx 8520440000_852044.P3P ;---- Component: Tetra Admin Proxy Lib 0001 ;---- Catalog: TAProxylib_app.mxx 8400000100000000_libTAProxy.P3L ;---- Component: NAR TSA Tetra 0521 ;---- Catalog: 8295...
by goodywp
23 Nov 2018 09:14
Forum: DOS Batch Forum
Topic: How to cut some blocks off the entire file then save into separated file
Replies: 23
Views: 3313

Re: How to cut off some blocks off the entire file then save into separated file

Thanks! ED! tried and got 2> was unexpected at this time. It was part of code for /F %%? in ( '^( find /V /C"" ^< "!$fileIn!" ^) 2>nul' ) do set "$NumberOfLines=%%?" When I took it off, it works but have some extra lines before the String my mistake, 2>nul should be 2^>nul because it's in a for. Yo...
by goodywp
23 Nov 2018 08:26
Forum: DOS Batch Forum
Topic: How to cut some blocks off the entire file then save into separated file
Replies: 23
Views: 3313

Re: How to cut off some blocks off the entire file then save into separated file

@echo off &setlocal enableDelayedExpansion set "$fileIn=Load_all.M83" set "$fileOu=Load_NAR.M83" > "!$fileOu!" type nul for /F %%? in ( '^( find /V /C"" ^< "!$fileIn!" ^) 2>nul' ) do set "$NumberOfLines=%%?" < "!$fileIn!" ( set /A $at = 0 &for /L %%i in ( 1, 1, !$NumberOfLines! ) do ( set "$=" &set...
by goodywp
22 Nov 2018 05:38
Forum: DOS Batch Forum
Topic: How to cut some blocks off the entire file then save into separated file
Replies: 23
Views: 3313

Re: How to cut off some blocks off the entire file then save into separated file

cutoff where ? at a specified byte position or based upon the occurrence of a string ? based upon the occurrence of a string. cut off all the strings before this line, in other words to save the strings starting from below line ;---- NAR signed binaries to the end. but also need to cut off unwanted...
by goodywp
21 Nov 2018 16:33
Forum: DOS Batch Forum
Topic: How to cut some blocks off the entire file then save into separated file
Replies: 23
Views: 3313

How to cut some blocks off the entire file then save into separated file

I have a task to cut off some blocks of entire file (Load_all.M83) then save it into a separated file (Load_NAR.M83). Here is the outline of this entire file structure, it is a catalog file ;---- Groupe signed binaries -epackage ;---- Component: EasyPath to Cless ;---- Catalog: Entry Point 0200000.M...
by goodywp
23 Aug 2018 12:28
Forum: DOS Batch Forum
Topic: Deleting specific lines from a text file
Replies: 6
Views: 1725

Re: Deleting specific lines from a text file

aGerman wrote:
23 Aug 2018 08:27
Are you serious that you really need help to remove the /x from the command line? There are two possibilities, either use the DEL or the backspace key.

Steffen
I would be more than happy to see the two possibilities... :D
Thanks
by goodywp
23 Aug 2018 08:14
Forum: DOS Batch Forum
Topic: Delete lines based upon string or file
Replies: 9
Views: 1930

Re: Delete lines based upon string or file

ups my mistake. I forgot that filenames should be used in the for /f loop with the usebackQ option. this damn cellphone. I tired the below code as you suggested, please correct me if I am wrong and still not working >tempFilterFile ( @ for /f "usebackq tokens=*" %%i in ("filterFile") do @ ( for %%j...
by goodywp
23 Aug 2018 06:15
Forum: DOS Batch Forum
Topic: Deleting specific lines from a text file
Replies: 6
Views: 1725

Re: Deleting specific lines from a text file

My apologize for the duplicated questions! Sorry......!
Could you help me to remove it.
Thanks
by goodywp
22 Aug 2018 15:16
Forum: DOS Batch Forum
Topic: Deleting specific lines from a text file
Replies: 6
Views: 1725

Deleting specific lines from a text file

Hi all, I had two text files one is whole and the other is part.txt Here is the content of whole.txt From \T501-08815-0103\Application_Signing\Signed_Schemes\QA_Infra-SL_0102_Signed_T3\ .500006011000.S3S .500007011000.S3S .500008011000.S3S .500009011000.S3S .500010011000.S3S .500011011000.S3S .50001...
by goodywp
22 Aug 2018 09:02
Forum: DOS Batch Forum
Topic: copy files from uncertain subfolders into another location
Replies: 9
Views: 2109

Re: copy files from uncertain subfolders into another location

FOR /F - Loop through items in a text file Not in your case. And you didn't answer my question of what you'll find in %%G. (hint: ECHO %%G helps to figure it out) FWIW FOR /F processes streams. That can be file streams besides of the standard output stream or string streams. In your example the sta...
by goodywp
09 Aug 2018 06:51
Forum: DOS Batch Forum
Topic: copy files from uncertain subfolders into another location
Replies: 9
Views: 2109

Re: copy files from uncertain subfolders into another location

~ d p n expands C: \bla\ blub .txt to C: \bla\ blub A few more questions to you: 1) Will the file be found if the file extension was stripped from the file name? 2) What is the difference between the content of %%G in the FOR /F loop and the content of %%G in the FOR /R loop? Steffen FOR /F - Loop ...
by goodywp
08 Aug 2018 13:21
Forum: DOS Batch Forum
Topic: copy files from uncertain subfolders into another location
Replies: 9
Views: 2109

Re: copy files from uncertain subfolders into another location

aGerman wrote:
08 Aug 2018 09:26
What do you think are the modifiers ~dpn for?

Steffen
expands %G to a drive letter and path only
tried using %~nxG expands %G to a file name and extension only not working :x