Search found 198 matches

by goodywp
20 Jul 2018 09:50
Forum: DOS Batch Forum
Topic: Delete lines based upon string or file
Replies: 9
Views: 2905

Re: Delete lines based upon string or file

used a combination with a for / f loop and a normal for loop. in the filter file can end semicolon, comma and space. in between, however, not - as well as no special characters like & () *? <> = | " >tempFilterFile ( @ for /f "delims=" %%i in ("filterFile") do @ ( for %%j in (%%i) do @ echo %%i ) )...
by goodywp
20 Jul 2018 07:52
Forum: DOS Batch Forum
Topic: Delete lines based upon string or file
Replies: 9
Views: 2905

Re: Delete lines based upon string or file

I tried another file as temp.txt 500011011000.S3S 500072010400.S3S and run the following code not working, any reason? findstr /v /g:temp.txt 829501.txt >updated.txt only the above removal.txt without comma working 50001101 50007201 findstr /v /g:removal.txt 829501.txt >updated.txt Works just fine....
by goodywp
19 Jul 2018 15:10
Forum: DOS Batch Forum
Topic: Delete lines based upon string or file
Replies: 9
Views: 2905

Re: Delete lines based upon string or file

I tried another file as temp.txt

500011011000.S3S
500072010400.S3S

and run the following code not working, any reason?

Code: Select all

findstr /v /g:temp.txt 829501.txt >updated.txt
only the above removal.txt without comma working
50001101
50007201

Code: Select all

findstr /v /g:removal.txt 829501.txt >updated.txt
by goodywp
19 Jul 2018 14:08
Forum: DOS Batch Forum
Topic: Delete lines based upon string or file
Replies: 9
Views: 2905

Re: Delete lines based upon string or file

if you use the file, without a concluding comma at the end of the line, you can also filter it with findstr /v /g:filterFile inputfile >outfile Phil Tried your code and exactly as you mentioned only work when the filterFile without a concluding comma at the end of the line... Now my case is that th...
by goodywp
19 Jul 2018 13:18
Forum: DOS Batch Forum
Topic: Delete lines based upon string or file
Replies: 9
Views: 2905

Delete lines based upon string or file

Hi I have a file which need to delete some lines based upon some strings This file is called 829501.txt \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 .5000120...
by goodywp
17 Jul 2018 16:00
Forum: DOS Batch Forum
Topic: How to Create a File List with some modification using Simple Batch File
Replies: 9
Views: 2509

Re: How to Create a File List with some modification using Simple Batch File

aGerman wrote:
17 Jul 2018 15:20
DO NOT OVERWRITE the predefined PATH variable!
You don't even need an additional variable because you already have %cd%.

Code: Select all

for /f "tokens=5* delims=\" %%a in ("%cd%") do set "base=%%b"
Steffen
Excellent! works as expected... :)
by goodywp
17 Jul 2018 14:35
Forum: DOS Batch Forum
Topic: How to Create a File List with some modification using Simple Batch File
Replies: 9
Views: 2509

Re: How to Create a File List with some modification using Simple Batch File

The passed folder is in %~1. The %cd% variable is set automatically and contains the current working directory. Steffen I tried %cd% as below code and works but got some issue set path=%cd% for /f "tokens=1,2,3,4,5,6,7,8,9,10,11 delims=\ " %%a in ("%path%") do set base=%%f\%%g\%%h\%%i\%%j\%%k set d...
by goodywp
17 Jul 2018 13:52
Forum: DOS Batch Forum
Topic: How to Create a File List with some modification using Simple Batch File
Replies: 9
Views: 2509

Re: How to Create a File List with some modification using Simple Batch File

From the above code, how can I add a dynamic directory level in the below set command set dir=DIRECTORY: \"%nptn%" --> set dir=DIRECTORY: \"%nptn%\subfolder" (this one for the subfolder level contents.lst) Sorry but you lost me. After the PUSHD command the current working directory is changed to th...
by goodywp
17 Jul 2018 12:34
Forum: DOS Batch Forum
Topic: How to Create a File List with some modification using Simple Batch File
Replies: 9
Views: 2509

Re: How to Create a File List with some modification using Simple Batch File

What is that funny bottom_contents.txt for? Recursion should work. @echo off &setlocal call :listdir "C:\auto_pkg_build\Workspace\Build_pkg\T592-08878-0101_Link2500_TCPX_NARInfra_GEN_PROD\T592-08878-0101" goto :eof :listdir pushd "%~1" 2>nul del "bottom_contents.txt" >"Contents.lst" type nul for /f...
by goodywp
17 Jul 2018 08:17
Forum: DOS Batch Forum
Topic: How to Create a File List with some modification using Simple Batch File
Replies: 9
Views: 2509

How to Create a File List with some modification using Simple Batch File

Hi all, I search up on internet to create a file list all the files and folders in a plain txt file as below code dir /b > fileslist.txt I used the below code to test my case and it did perfectly as below: @echo off cd C:\auto_pkg_build\Workspace\Build_pkg\T592-08878-0101_Link2500_TCPX_NARInfra_GEN_...
by goodywp
16 Jul 2018 06:58
Forum: DOS Batch Forum
Topic: batch job to do string replacement of contents.lst file in all subfolders
Replies: 4
Views: 1698

Re: new job to do a batch of replacement of contents.lst

I tried use below code and end up after line 22 11 22 The system cannot find the path specified. C:\auto_pkg_build\Workspace\Build_pkg\T592-08878-0101_Link2500_TCPX_NARInfra_GEN _PROD\T592-08878-0101\*, Are you sure (Y/N)? @Echo Off SETLOCAL EnableDelayedExpansion call C:\auto_pkg_build\Scripts\sche...
by goodywp
13 Jul 2018 11:47
Forum: DOS Batch Forum
Topic: batch job to do string replacement of contents.lst file in all subfolders
Replies: 4
Views: 1698

Re: new job to do a batch of replacement of contents.lst

I would parse the output of the DIR command with a FOR /F command to get a listing of all the files. FOR /F "delims=" %%G IN ('dir /a-d /b /s contents.lst') DO........ Thanks and tried this following code not working as expected for all subfolders' replacement @Echo Off call C:\auto_pkg_build\Scrip...
by goodywp
12 Jul 2018 13:35
Forum: DOS Batch Forum
Topic: batch job to do string replacement of contents.lst file in all subfolders
Replies: 4
Views: 1698

batch job to do string replacement of contents.lst file in all subfolders

Hi all, I have a new task to do a batch job to replace all subfolders's contents.lst files Here is the example: C:\level1\level2\level3 \level3a\level4 \level4a\level5 \level3b Now the requirement is that under level2 folder, there is a contents.lst file which mainly display the list of files and fo...
by goodywp
12 Jul 2018 08:34
Forum: DOS Batch Forum
Topic: How to freely select one column based on another column data?
Replies: 17
Views: 5795

Re: How to freely select one column based on another column data?

I had some issue for this code. It was OK when the column is not that much. But now after adding more column and getting some weird issue, for some column I got the error back again Here is my config file MOCKUP_DL QA_DL US_PROD_DL TD_DL GPC_DL ELAVON_DL DESJAR_DL CA_PROD_DL . . . . . my source col...
by goodywp
28 Jun 2018 15:26
Forum: DOS Batch Forum
Topic: How to freely select one column based on another column data?
Replies: 17
Views: 5795

Re: How to freely select one column based on another column data?

The input example and code example you have given does not produce that error. PERIOD! strange on my PC keep giving me error but if I switch to TD_DL or US_PROD_DL they both OK.... :cry: Create a zip file with your batch file and all your input files and attach the zip file to a post. Tried another...