Help with find and replace with wildcards in text file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
jb-hca
Posts: 4
Joined: 21 Mar 2018 12:05

Help with find and replace with wildcards in text file

#1 Post by jb-hca » 21 Mar 2018 12:45

Hi, All! I've been trying to do a find and replace from some text files but I'm having trouble. I am using jrepl but I'm new to regular expressions and can't figure out how to get there. I've been reading the jrepl.bat file as well as the msdn page for two days and I think my head is going to pop. Can one of you help this noob out? :mrgreen:


What I want to happen:
Bat 1: Find and replace everything up to and including "DO NOT REMOVE" (It's close to the bottom) in "acad - old.pgp" with nothing and resave the file. The number of lines varies as does the content so I can't just trim off the last 20 or so lines.

Bat 2: Find and replace everything in "acad - new.pgp" after "DO NOT REMOVE" with the contents of the edited file from "acad - old.pgp" (new is the same as old so I'm not duplicating the info below).

The scripts will be run at different times, so they will need to function independently.




acad - old.pgp

Code: Select all

; 
;
;  Program Parameters File For Autodesk AutoCAD 2018
;  External Command and Command Alias Definitions

;  Copyright 2017 Autodesk, Inc.  All rights reserved.
;
;  Use of this software is subject to the terms of the Autodesk license 
;  agreement provided at the time of installation or download, or which 
;  otherwise accompanies this software in either electronic or hard copy form.

;  Each time you open a new or existing drawing, AutoCAD searches 
;  the support path and reads the first acad.pgp file that it finds.

;  -- External Commands --
;  While AutoCAD is running, you can invoke other programs or utilities
;  such Windows system commands, utilities, and applications.
;  You define external commands by specifying a command name to be used
;  from the AutoCAD command prompt and an executable command string 
;  that is passed to the operating system. 

;  -- Command Aliases --
;  The Command Aliases section of this file provides default settings for
;  AutoCAD command shortcuts.  Note: It is not recommended that  you directly
;  modify this section of the PGP file., as any changes you make to this section of the 
;  file will not migrate successfully if you upgrade your AutoCAD to a
;  newer version.  Instead, make changes to the new 
;  User Defined Command Aliases
;  section towards the end of this file.

;  -- User Defined Command Aliases --
;  You can abbreviate frequently used AutoCAD commands by defining 
;  aliases for them in the User Defined Command Aliases section of acad.pgp.
;  You can create a command alias for any AutoCAD command,
;  device driver command, or external command.

;  Recommendation: back up this file before editing it.  To ensure that
;  any changes you make to PGP settings can successfully be migrated
;  when you upgrade to the next version of AutoCAD, it is suggested that
;  you make any changes to the default settings in the User Defined Command 
;  Aliases section at the end of this file.

;  External command format:
;  <Command name>,[<Shell request>],<Bit flag>,[*]<Prompt>,

;  The bits of the bit flag have the following meanings:
;  Bit 1: if set, don't wait for the application to finish
;  Bit 2: if set, run the application minimized
;  Bit 4: if set, run the application "hidden"
;  Bit 8: if set, put the argument string in quotes
;
;  Fill the "bit flag" field with the sum of the desired bits.
;  Bits 2 and 4 are mutually exclusive; if both are specified, only 
;  the 2 bit is used. The most useful values are likely to be 0 
;  (start the application and wait for it to finish), 1 (start the 
;  application and don't wait), 3 (minimize and don't wait), and 5 
;  (hide and don't wait). Values of 2 and 4 should normally be avoided, 
;  as they make AutoCAD unavailable until the application has completed.
;
;  Bit 8 allows commands like DEL to work properly with filenames that 
;  have spaces such as "long filename.dwg".  Note that this will interfere 
;  with passing space delimited lists of file names to these same commands.
;  If you prefer multiplefile support to using long file names, turn off 
;  the "8" bit in those commands.

;  Examples of external commands for command windows

DEL,       DEL,            8,File to delete: ,
DIR,       DIR,            8,File specification: ,
SH,        ,               1,*OS Command: ,
SHELL,     ,               1,*OS Command: ,
START,     START,          1,*Application to start: ,
TYPE,      TYPE,           8,File to list: ,

; Examples of external commands for Windows
; See also the (STARTAPP) AutoLISP function for an alternative method.

EXPLORER,  START EXPLORER, 1,,
NOTEPAD,   START NOTEPAD,  1,*File to edit: ,
PBRUSH,    START PBRUSH,   1,,


; Command alias format:
;   <Alias>,*<Full command name>

;  The following are guidelines for creating new command aliases.
;  1. An alias should reduce a command by at least two characters. 
;      Commands with a control key equivalent, status bar button, 
;      or function key do not require a command alias. 
;      Examples: Control N, O, P, and S for New, Open, Print, Save.
;  2. Try the first character of the command, then try the first two, 
;      then the first three.
;  3. Once an alias is defined, add suffixes for related aliases: 
;      Examples: R for Redraw, RA for Redrawall, L for Line, LT for 
;      Linetype.
;  4. Use a hyphen to differentiate between command line and dialog 
;      box commands.
;      Example: B for Block, -B for -Block.
;
; Exceptions to the rules include AA for Area, T for Mtext, X for Explode.

;  -- Sample aliases for AutoCAD commands --                   
;  These examples include most frequently used commands.  NOTE: It is recommended 
;  that you not make any changes to this section of the PGP file to ensure the 
;  proper migration of your customizations when you upgrade to the next version of 
;  AutoCAD.  The aliases listed in this section are repeated in the User Custom
;  Settings section at the end of this file, which can safely be edited while
;  ensuring your changes will successfully migrate.



3A,        *3DARRAY
3DMIRROR,  *MIRROR3D
3DNavigate,*3DWALK
3DO,       *3DORBIT
3DP,	   *3DPRINT
3DPLOT,    *3DPRINT
3DW,       *3DWALK
3F,        *3DFACE
3M,        *3DMOVE
3P,        *3DPOLY
3R,        *3DROTATE
3S,        *3DSCALE
A,         *ARC
AC,        *BACTION
ADC,       *ADCENTER
AECTOACAD, *-ExportToAutoCAD
AA,        *AREA
AL,        *ALIGN
3AL,       *3DALIGN
AP,        *APPLOAD
APLAY,     *ALLPLAY
AR,        *ARRAY
-AR,       *-ARRAY
ARR,       *ACTRECORD
ARM,       *ACTUSERMESSAGE
-ARM,      *-ACTUSERMESSAGE
ARU,       *ACTUSERINPUT
ARS,       *ACTSTOP
-ARS,       *-ACTSTOP
ATI,       *ATTIPEDIT
ATT,       *ATTDEF
-ATT,      *-ATTDEF
ATE,       *ATTEDIT
-ATE,      *-ATTEDIT
ATTE,      *-ATTEDIT
B,         *BLOCK
-B,        *-BLOCK
BC,        *BCLOSE
BE,        *BEDIT
BH,        *HATCH
BLENDSRF,  *SURFBLEND
BO,        *BOUNDARY
-BO,       *-BOUNDARY
BR,        *BREAK
BS,        *BSAVE
BVS,       *BVSTATE
C,         *CIRCLE
CAM,       *CAMERA
CBAR,      *CONSTRAINTBAR
CH,        *PROPERTIES
-CH,       *CHANGE
CHA,       *CHAMFER
CHK,       *CHECKSTANDARDS
CLI,       *COMMANDLINE
CMATTACH,  *COORDINATIONMODELATTACH
-CMATTACH,  *-COORDINATIONMODELATTACH
COL,       *COLOR
COLOUR,    *COLOR
CO,        *COPY
CONVTOMESH, *MESHSMOOTH
CP,        *COPY
CPARAM,    *BCPARAMETER
CREASE,    *MESHCREASE
CREATESOLID, *SURFSCULPT
CSETTINGS, *CONSTRAINTSETTINGS
CT,        *CTABLESTYLE
CUBE,      *NAVVCUBE
CURVATUREANALYSIS, *ANALYSISCURVATURE
CYL,       *CYLINDER
D,         *DIMSTYLE
DAL,       *DIMALIGNED
DAN,       *DIMANGULAR
DAR,       *DIMARC
DELETE,    *ERASE
JOG,       *DIMJOGGED
DBA,       *DIMBASELINE
DBC,       *DBCONNECT
DC,        *ADCENTER
DCE,       *DIMCENTER
DCENTER,   *ADCENTER
DCO,       *DIMCONTINUE
DCON,      *DIMCONSTRAINT
DDA,       *DIMDISASSOCIATE
DDEDIT,    *TEXTEDIT
DDI,       *DIMDIAMETER
DDPTYPE,   *PTYPE
DDVPOINT,  *VPOINT
DED,       *DIMEDIT
DELCON,    *DELCONSTRAINT
DI,        *DIST
DIV,       *DIVIDE
DJL,       *DIMJOGLINE
DJO,       *DIMJOGGED
DL,        *DATALINK
DLI,       *DIMLINEAR
DLU,       *DATALINKUPDATE
DO,        *DONUT
DOR,       *DIMORDINATE
DOV,       *DIMOVERRIDE
DR,        *DRAWORDER
DRA,       *DIMRADIUS
DRAFTANGLEANALYSIS, *ANALYSISDRAFTANGLE
DRE,       *DIMREASSOCIATE
DRM,       *DRAWINGRECOVERY
DS,        *DSETTINGS
DST,       *DIMSTYLE
DT,        *TEXT
DV,        *DVIEW
DX,        *DATAEXTRACTION
E,         *ERASE
ED,        *TEXTEDIT
EL,        *ELLIPSE
ER,        *EXTERNALREFERENCES
ESHOT,     *EDITSHOT
EX,        *EXTEND
EXIT,      *QUIT
EXP,       *EXPORT
EXT,       *EXTRUDE
EXTENDSRF, *SURFEXTEND
F,         *FILLET
FI,        *FILTER
FILLETSRF, *SURFFILLET
FREEPOINT, *POINTLIGHT
FSHOT,     *FLATSHOT
G,         *GROUP
-G,        *-GROUP
GCON,      *GEOMCONSTRAINT
GD,        *GRADIENT
GENERATESECTION,  *SECTIONPLANETOBLOCK
GEO,       *GEOGRAPHICLOCATION
GR,        *DDGRIPS
H,         *HATCH
-H,        *-HATCH
HE,        *HATCHEDIT
HB,        *HATCHTOBACK
HI,        *HIDE
I,         *INSERT
-I,        *-INSERT
IAD,       *IMAGEADJUST
IAT,       *IMAGEATTACH
ICL,       *IMAGECLIP
IM,        *IMAGE
-IM,       *-IMAGE
IMP,       *IMPORT
IN,        *INTERSECT
INSERTCONTROLPOINT, *CVADD
INF,       *INTERFERE
IO,        *INSERTOBJ
ISOLATE,   *ISOLATEOBJECTS
QVD,       *QVDRAWING
QVDC,      *QVDRAWINGCLOSE
QVL,       *QVLAYOUT
QVLC,      *QVLAYOUTCLOSE
J,         *JOIN
JOGSECTION,  *SECTIONPLANEJOG
L,         *LINE
LA,        *LAYER
-LA,       *-LAYER
LAS,       *LAYERSTATE
LE,        *QLEADER
LEN,       *LENGTHEN
LESS,      *MESHSMOOTHLESS
LI,        *LIST
LINEWEIGHT, *LWEIGHT
LMAN,      *LAYERSTATE
LO,        *-LAYOUT
LS,        *LIST
LT,        *LINETYPE
-LT,       *-LINETYPE
LTYPE,     *LINETYPE
-LTYPE,    *-LINETYPE
LTS,       *LTSCALE
LW,        *LWEIGHT
M,         *MOVE
MA,        *MATCHPROP
MAT,       *MATBROWSEROPEN
ME,        *MEASURE
MEA,       *MEASUREGEOM
MI,        *MIRROR
ML,        *MLINE
MLA,       *MLEADERALIGN
MLC,       *MLEADERCOLLECT
MLD,       *MLEADER
MLE,       *MLEADEREDIT
MLS,       *MLEADERSTYLE
MO,        *PROPERTIES
MORE,      *MESHSMOOTHMORE
MOTION,    *NAVSMOTION
MOTIONCLS, *NAVSMOTIONCLOSE
MS,        *MSPACE
MSM,       *MARKUP
MT,        *MTEXT
MV,        *MVIEW
NETWORKSRF,*SURFNETWORK
NORTH,     *GEOGRAPHICLOCATION
NORTHDIR,  *GEOGRAPHICLOCATION
NSHOT,     *NEWSHOT
NVIEW,     *NEWVIEW
O,         *OFFSET
OFFSETSRF, *SURFOFFSET
OP,        *OPTIONS
ORBIT,     *3DORBIT
OS,        *OSNAP
-OS,       *-OSNAP
P,         *PAN
-P,        *-PAN
PA,        *PASTESPEC
RAPIDPROTOTYPE, *3DPRINT
PAR,       *PARAMETERS
-PAR,      *-PARAMETERS
PARAM,     *BPARAMETER
PARTIALOPEN, *-PARTIALOPEN
PATCH,     *SURFPATCH
PCATTACH,  *POINTCLOUDATTACH
EPDFSHX,   *PDFSHX
PE,        *PEDIT
PL,        *PLINE
PO,        *POINT
POFF,      *HIDEPALETTES
POINTON,   *CVSHOW
POINTOFF,  *CVHIDE
POL,       *POLYGON
PON,       *SHOWPALETTES
PR,        *PROPERTIES
PRCLOSE,   *PROPERTIESCLOSE
PROPS,     *PROPERTIES
PRE,       *PREVIEW
PRINT,     *PLOT
PS,        *PSPACE
PSOLID,    *POLYSOLID
PTW,       *PUBLISHTOWEB
PU,        *PURGE
-PU,       *-PURGE
PYR,       *PYRAMID
QC,        *QUICKCALC
QCUI,      *QUICKCUI
QP,        *QUICKPROPERTIES
R,         *REDRAW
RA,        *REDRAWALL
RC,        *RENDERCROP
RE,        *REGEN
REA,       *REGENALL
REBUILD,   *CVREBUILD
REC,       *RECTANG
REFINE,    *MESHREFINE
REG,       *REGION
REMOVECONTROLPOINT, *CVREMOVE
REN,       *RENAME
-REN,      *-RENAME
REV,       *REVOLVE
RO,        *ROTATE
RP,        *RENDERPRESETS
RPR,       *RPREF
RR,        *RENDER
RW,        *RENDERWINDOW
S,         *STRETCH
SC,        *SCALE
SCR,       *SCRIPT
SE,        *DSETTINGS
SEC,       *SECTION
SET,       *SETVAR
SHA,       *SHADEMODE
SL,        *SLICE
SMOOTH,    *MESHSMOOTH
SN,        *SNAP
SO,        *SOLID
SP,        *SPELL
SPL,       *SPLINE
SPLANE,    *SECTIONPLANE
SPLAY,     *SEQUENCEPLAY
SPLIT,     *MESHSPLIT
SPE,       *SPLINEDIT
SSM,       *SHEETSET
ST,        *STYLE
STA,       *STANDARDS
SU,        *SUBTRACT
T,         *MTEXT
-T,        *-MTEXT
TA,        *TEXTALIGN
TB,        *TABLE
TEDIT,     *TEXTEDIT
TH,        *THICKNESS
TI,        *TILEMODE
TO,        *TOOLBAR
TOL,       *TOLERANCE
TOR,       *TORUS
TP,        *TOOLPALETTES
TR,        *TRIM
TS,        *TABLESTYLE
UC,        *UCSMAN
UN,        *UNITS
-UN,       *-UNITS
UNCREASE,  *MESHUNCREASE
UNHIDE,    *UNISOLATEOBJECTS
UNI,       *UNION
UNISOLATE, *UNISOLATEOBJECTS
V,         *VIEW
VGO,       *VIEWGO
VPLAY,     *VIEWPLAY
-V,        *-VIEW
VP,        *VPOINT
-VP,       *-VPOINT
VS,	   *VSCURRENT
VSM,       *VISUALSTYLES
-VSM,      *-VISUALSTYLES
W,         *WBLOCK
-W,        *-WBLOCK
WE,        *WEDGE
WHEEL,     *NAVSWHEEL
X,         *EXPLODE
XA,        *XATTACH
XB,        *XBIND
-XB,       *-XBIND
XC,        *XCLIP
XL,        *XLINE
XR,        *XREF
-XR,       *-XREF
Z,         *ZOOM
ZEBRA,     *ANALYSISZEBRA

; The following are alternative aliases and aliases as supplied 
;  in AutoCAD Release 13.

AV,        *DSVIEWER
CP,        *COPY
DIMALI,    *DIMALIGNED
DIMANG,    *DIMANGULAR
DIMBASE,   *DIMBASELINE
DIMCONT,   *DIMCONTINUE
DIMDIA,    *DIMDIAMETER
DIMED,     *DIMEDIT
DIMTED,    *DIMTEDIT
DIMLIN,    *DIMLINEAR
DIMORD,    *DIMORDINATE
DIMRAD,    *DIMRADIUS
DIMSTY,    *DIMSTYLE
DIMOVER,   *DIMOVERRIDE
LEAD,      *LEADER
TM,        *TILEMODE

; Aliases for Hyperlink/URL Release 14 compatibility
SAVEURL, *SAVE
OPENURL,   *OPEN
INSERTURL, *INSERT

; Aliases for commands discontinued in AutoCAD 2000:
AAD,        *DBCONNECT
AEX,        *DBCONNECT 
ALI,        *DBCONNECT 
ASQ,        *DBCONNECT 
ARO,        *DBCONNECT 
ASE,        *DBCONNECT
DDATTDEF,   *ATTDEF
DDATTEXT,   *ATTEXT
DDCHPROP,   *PROPERTIES
DDCOLOR,    *COLOR
DDLMODES,   *LAYER
DDLTYPE,    *LINETYPE
DDMODIFY,   *PROPERTIES
DDOSNAP,    *OSNAP
DDUCS,      *UCS

; Aliases for commands discontinued in AutoCAD 2004:
ACADBLOCKDIALOG,  *BLOCK
ACADWBLOCKDIALOG, *WBLOCK
ADCENTER,         *ADCENTER
BMAKE,            *BLOCK
BMOD,             *BLOCK
BPOLY,            *BOUNDARY
CONTENT,          *ADCENTER
DDATTE,           *ATTEDIT
DDIM,             *DIMSTYLE
DDINSERT,         *INSERT
DDPLOTSTAMP,      *PLOTSTAMP
DDRMODES,         *DSETTINGS
DDSTYLE,          *STYLE
DDUCS,            *UCSMAN
DDUCSP,           *UCSMAN
DDUNITS,          *UNITS
DDVIEW,           *VIEW
DIMHORIZONTAL,    *DIMLINEAR
DIMROTATED,       *DIMLINEAR
DIMVERTICAL,      *DIMLINEAR
DOUGHNUT,         *DONUT
DTEXT,            *TEXT
DWFOUT,           *PLOT
DXFIN,            *OPEN
DXFOUT,           *SAVEAS
PAINTER,          *MATCHPROP
PREFERENCES,      *OPTIONS
RECTANGLE,        *RECTANG
SHADE,            *SHADEMODE
VIEWPORTS,        *VPORTS
EDWFX,            *EXPORTDWFX
EDWF,             *EXPORTDWF
EPDF,             *EXPORTPDF
-QPUB,            *-EXPORT
; Aliases for commands discontinued in AutoCAD 2007:
RMAT,      *MATBROWSEROPEN
FOG,       *RENDERENVIRONMENT
FINISH,    *MATERIALS
SETUV,     *MATERIALMAP
SHOWMAT,   *LIST
RFILEOPT,  *RENDERPRESETS
RENDSCR,   *RENDERWINDOW


; Aliases for sysvars discontinued in AutoCAD 2013:
RASTERPREVIEW,      *THUMBSAVE
AUTOCOMPLETE,       *-INPUTSEARCHOPTIONS
AUTOCOMPLETEMODE,   *-INPUTSEARCHOPTIONS
AUTOCOMPLETEDELAY,  *INPUTSEARCHDELAY

; Aliases for commands discontinued in AutoCAD 2014:
3DCONFIG,           *GRAPHICSCONFIG
-3DCONFIG,          *-GRAPHICSCONFIG

; Aliases for commands discontinued in AutoCAD 2015:
CM,					*CENTERMARK
CL,					*CENTERLINE

;  -- User Defined Command Aliases --
;  Make any changes or additions to the default AutoCAD command aliases in 
;  this section to ensure successful migration of these settings when you
;  upgrade to the next version of AutoCAD.  If a command alias appears more
;  than once in this file, items in the User Defined Command Alias take
;  precedence over duplicates that appear earlier in the file.
;  **********----------**********  ; No xlate ; DO NOT REMOVE


C,         *COPY
CI,         *CIRCLE
DO,         *DRAWORDER
D,         *DIST
D,         *DIST
LC,			*LAYMCUR
SL,			*SCALELISTEDIT
SLE, 		*SCALELISTEDIT
RD, 		*REFEDIT
RC, 		*REFCLOSE
UG, 		*UNGROUP



Code: Select all

 INFO.BAT version 1.4
--------------------------------------------------------------------------------
Windows version        :  Microsoft Windows [Version 10.0.16299.309]
Product name           :  Windows 10 Pro, 64 bit
Performance indicators :  Processor Cores: 8      Visible RAM: 33495068 kilobytes

Date/Time format       :  (mm/dd/yy)  Wed 03/21/2018  14:24:07.45
__APPDIR__             :  C:\WINDOWS\system32\
ComSpec                :  C:\WINDOWS\system32\cmd.exe
PathExt                :  .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Extensions             :  system: Enabled   user: Enabled 
Delayed expansion      :  system: Disabled  user: Disabled
Locale name            :  en-US       Code Pages: OEM  437    ANSI 1252
DIR  format            :  03/20/2018  03:28 PM     5,100,273,664 pagefile.sys
Permissions            :  Elevated Admin=No, Admin group=Yes

                          Missing from the tool collection:  debug

jb-hca
Posts: 4
Joined: 21 Mar 2018 12:05

Re: Help with find and replace with wildcards in text file

#2 Post by jb-hca » 21 Mar 2018 14:31

Woo hoo! Progress. I think I have found it except that I can't kill the first ; at the beginning of the file.

Code: Select all

call jrepl "$[\s\S]*DO.NOT.REMOVE" "" /m /f "acad - Copy (2).txt" /o -

jb-hca
Posts: 4
Joined: 21 Mar 2018 12:05

Re: Help with find and replace with wildcards in text file

#3 Post by jb-hca » 21 Mar 2018 14:41

Got it :)

Code: Select all

call jrepl "^.*$[\s\S]*DO.NOT.REMOVE" "" /m /f "acad - Copy (2).txt" /o -

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: Help with find and replace with wildcards in text file

#4 Post by dbenham » 21 Mar 2018 15:01

The $ marks the point before the end of a line, so of course your script will preserve all characters up until the end of the 1st line.

Simply remove the $ and you will get your desired result (although it will preserve the End-Of-Line characters (\r\n) after the DO NOT REMOVE.

I would explicitly look for spaces instead of any character

Code: Select all

call jrepl "[\s\S]*DO NOT REMOVE" "" /m /f "acad - Copy (2).txt" /o -
Another way to do this is to use the /INC option to specify you want to only search lines starting with the first line after DO NOT REMOVE. I use the simple regular expression of /DO NOT REMOVE/ to find the string, and then add an offset of one to set the beginning of the include block. For the end of the block range I use a regex that is guaranteed to never match anything - /$./ looks for a character after the end of the line, which is impossible. So the end of the include block is the end of the file.

You can use the /K 0 option to keep matching lines, and "^" is guaranteed to match any line, and the replacement string is still required, but ignored - I use "".

This will have one less empty line in the result because it will remove the entire line containing DO NOT REMOVE, including the \r\n.

Code: Select all

call jrepl "^" "" /k 0 /inc "/DO NO REMOVE/+1:/$./" /f "acad - Copy (2).txt" /o -
This second way of using JREPL is a bit more complicated, but it has no limit to the size of the input file because it reads one line at a time. The /M option requires the entire source file to be loaded into memory, which can cause problems with really big files.

But there really isn't much need for JREPL.BAT for such a simple task. You can use FINDSTR to find the line number that contains DO NOT REMOVE, and then use MORE +N to write out the file, skipping N lines.

Code: Select all

for /f "delims=:" %%N in ('findstr /n /c:"DO NOT REMOVE" "acad - Copy (2).txt"') do set "skip=%%N"
more +%skip% "acad - Copy (2).txt"' >"acad - Copy (2).txt.new"'
move "acad - Copy (2).txt.new" "acad - Copy (2).txt"' >nul
The above assumes you don't have any TAB characters (MORE will convert them into a set of spaces), and also assumes your file is <~65k lines. MORE will hang if it reaches ~65k lines (I can't remember the exact number).

But, now that you have JREPL.BAT, I certainly see no problem with using it :D


I don't understand what you are trying to do with the 2nd part of your question.

Dave Benham

jb-hca
Posts: 4
Joined: 21 Mar 2018 12:05

Re: Help with find and replace with wildcards in text file

#5 Post by jb-hca » 23 Mar 2018 10:03

there really isn't much need for JREPL.BAT for such a simple task. You can use FINDSTR
So much to learn... Thank you for your help @dbenham ! I will work through your suggestions and report back if I run into more trouble :)

Post Reply