Aacini wrote:PS - There is a new answer at S.O. that show a very clear example of /O and /B switches usage; perhaps you want to review it. It is here.
Thanks Antonio, that's useful and explains the /$ switch for me.
Moderator: DosItHelp
Aacini wrote:PS - There is a new answer at S.O. that show a very clear example of /O and /B switches usage; perhaps you want to review it. It is here.
bars143 wrote:Aacini , its working with "/J" switch but i dont know that your machine produced blanks as compared to my windows xp sp3 32it.
Bars
Code: Select all
type inputfile.txt |FindRepl "View" /a "displayed"
type inputfile.txt |FindRepl "View" /a "displayed"
type inputfile.txt |FindRepl "view" /a "displayed"
type inputfile.txt |FindRepl "view" /a "displayed"
Code: Select all
type inputfile.txt |FindRepl /i "View" /a "displayed"
type inputfile.txt |FindRepl "View" /a "displayed"
type inputfile.txt |FindRepl /i "view" /a "displayed"
type inputfile.txt |FindRepl "view" /a "displayed"
Aacini wrote:bars143 wrote:Aacini , its working with "/J" switch but i dont know that your machine produced blanks as compared to my windows xp sp3 32it.
Bars
Note that your code execute these 4 commands:Code: Select all
type inputfile.txt |FindRepl "View" /a "displayed"
type inputfile.txt |FindRepl "View" /a "displayed"
type inputfile.txt |FindRepl "view" /a "displayed"
type inputfile.txt |FindRepl "view" /a "displayed"
That is, no one of the commands have the /i switch! My modified code execute these commands:Code: Select all
type inputfile.txt |FindRepl /i "View" /a "displayed"
type inputfile.txt |FindRepl "View" /a "displayed"
type inputfile.txt |FindRepl /i "view" /a "displayed"
type inputfile.txt |FindRepl "view" /a "displayed"
Sometimes I don't clearly express myself...
IMPORTANT: Note that in the "solution" the replacement string is enclosed in quotes and apostrophes: FindRepl /i "view" /a "'displayed'" /J; this is required because "displayed" (in quotes) is a literal string, but "'displayed'" (in quotes and apostrophes) is a JScript expression!
Antonio
there are two doublecolon : symbols : here
there are two doublequotes marks "symbols" here
there are less and greater than < symbols > here
there are questionmark and asterisk ? symbols * here
there are backslash and slash \ symbols / here
there are pipe and exclaimation marks | symbols ! here
Code: Select all
@echo off
echo deleting characters:
type inputfile.txt |FindRepl ":|'|<|>|\?|\*|\\|/|\||\!" /A "" /Q:'
echo replacements:
type inputfile.txt |FindRepl ":|'|<|>|\?|\*|\\|/|\||\!" /A "[DC]|[DQ]|[LS]|[GR]|[QM]|[ST]|[BS]|[SL]|[PI]|[EM]" /Q:'
pause
exit
Code: Select all
deleting characters:
there are two doublecolon symbols here
there are two doublequotes marks symbols here
there are less and greater than symbols here
there are questionmark and asterisk symbols here
there are backslash and slash symbols here
there are pipe and exclaimation marks symbols here
replacements:
there are two doublecolon [DC] symbols [DC] here
there are two doublequotes marks [DQ]symbols[DQ] here
there are less and greater than [LS] symbols [GR] here
there are questionmark and asterisk symbols here
there are backslash and slash [PI] symbols [SL] here
there are pipe and exclaimation marks symbols here
Press any key to continue . . .
foxidrive wrote:Bars, did you describe and provide the output that you are trying to get?
Code: Select all
there are two doublecolon [DC] symbols [DC] here
there are two doublequotes marks [DQ]symbols[DQ] here
there are less and greater than [LS] symbols [GR] here
there are questionmark and asterisk [QM] symbols [ST] here
there are backslash and slash [BS] symbols [SL] here
there are pipe and exclaimation marks [PI] symbols [EM] here
Code: Select all
there are two doublecolon [DC] symbols [DC] here
there are two doublequotes marks [DQ]symbols[DQ] here
there are less and greater than [LS] symbols [GR] here
there are questionmark and asterisk symbols here
there are backslash and slash [PI] symbols [SL] here
there are pipe and exclaimation marks symbols here
Code: Select all
@echo off
echo deleting characters:
type inputfile.txt |FindRepl ":|'|<|>|\?|\*|\\|/|\||\!" /A "" /Q:'
echo replacements:
type inputfile.txt |FindRepl ":|'|<|>|\?|\*|\\|/|\||\!" /A "[DC]|[DQ]|[LS]|[GR]|[QM]|[ST]|[BS]|[SL]|[PI]|[EM]" /Q:'
pause
exit
Code: Select all
echo a?bcd|findrepl "\?|b|c|d" /A "[QM]|[ST]|[BS]|[EM]"
Code: Select all
echo a?bcd|findrepl "?|b|c|d" /A "[QM]|[ST]|[BS]|[EM]"
Code: Select all
C:\> echo a?bcd|findrepl "\?||b||c||d" /A "'[QM]'||'[ST]'||'[BS]'||'[EM]'" /J
a[QM][ST][BS][EM]
Code: Select all
@echo off
echo INDIVIDUAL REPLACEMENT:
type inputfile.txt |FindRepl "\|" "'[PI]'" /J >outputfile.txt
type outputfile.txt |FindRepl "\!" "'[EM]'" /J >outputfile.txt
type outputfile.txt |FindRepl "\*" "'[ST]'" /J >outputfile.txt
type outputfile.txt |FindRepl "\?" "'[QM]'" /J >outputfile.txt
type outputfile.txt |FindRepl "\\" "'[BS]'" /J >outputfile.txt
type outputfile.txt |FindRepl "\/" "'[SL]'" /J >outputfile.txt
type outputfile.txt
echo ALTERNATION REPLACEMENT:
type outputfile.txt |FindRepl ":|'|<|>|\*" /A "[DC]|[DQ]|[LS]|[GR]|[ST]" /Q:'
pause
exit
Code: Select all
there are two doublecolon : symbols : here
there are two doublequotes marks "symbols" here
there are less and greater than < symbols > here
there are questionmark and asterisk ? symbols * here
there are backslash and slash \ symbols / here
there are pipe and exclaimation marks | symbols ! here
Code: Select all
INDIVIDUAL REPLACEMENT:
there are two doublecolon : symbols : here
there are two doublequotes marks "symbols" here
there are less and greater than < symbols > here
there are questionmark and asterisk [QM] symbols [ST] here
there are backslash and slash [BS] symbols [SL] here
there are pipe and exclaimation marks [PI] symbols [EM] here
ALTERNATION REPLACEMENT:
there are two doublecolon [DC] symbols [DC] here
there are two doublequotes marks [DQ]symbols[DQ] here
there are less and greater than [LS] symbols [GR] here
there are questionmark and asterisk [QM] symbols [ST] here
there are backslash and slash [BS] symbols [SL] here
there are pipe and exclaimation marks [PI] symbols [EM] here
Press any key to continue . . .
Code: Select all
type inputfile.txt |findrepl "(\|)||!||\*||\?||\\||/||:||'||<||>" /A "'[PI]'||'[EM]'||'[ST]'||'[QM]'||'[BS]'||'[SL]'||'[DC]'||'[DQ]'||'[LS]'||'[GR]'" /J /Q:'
Code: Select all
type inputfile.txt |findrepl "!||\*||\?||\\||/||:||'||<||>||\|" /A "'[EM]'||'[ST]'||'[QM]'||'[BS]'||'[SL]'||'[DC]'||'[DQ]'||'[LS]'||'[GR]'||'[PI]'" /J /Q:'
Code: Select all
there are two doublecolon [DC] symbols [DC] here
there are two doublequotes marks [DQ]symbols[DQ] here
there are less and greater than [LS] symbols [GR] here
there are questionmark and asterisk [QM] symbols [ST] here
there are backslash and slash [BS] symbols [SL] here
there are pipe and exclaimation marks [PI] symbols [EM] here
foxidrive wrote:It can be done in one pass, Bars, but the first term using a pipe needs special handling, using findstr V2.0Code: Select all
type inputfile.txt |findrepl "(\|)||!||\*||\?||\\||/||:||'||<||>" /A "'[PI]'||'[EM]'||'[ST]'||'[QM]'||'[BS]'||'[SL]'||'[DC]'||'[DQ]'||'[LS]'||'[GR]'" /J /Q:'
Code: Select all
jrepl ": \q < > ? * \ / | !" "[DC] [DQ] [LS] [GR] [QM] [ST] [BS] [SL] [PI] [EM]" /l /x /t " " /f input.txt
Code: Select all
jrepl ": \q < > \? \* \\ / \| !" "[DC] [DQ] [LS] [GR] [QM] [ST] [BS] [SL] [PI] [EM]" /x /t " " /f input.txt
dbenham wrote:It is very simple with JREPL v2.
As literal values:Code: Select all
jrepl ": \q < > ? * \ / | !" "[DC] [DQ] [LS] [GR] [QM] [ST] [BS] [SL] [PI] [EM]" /l /x /t " " /f input.txt
Or as a regular expressions:Code: Select all
jrepl ": \q < > \? \* \\ / \| !" "[DC] [DQ] [LS] [GR] [QM] [ST] [BS] [SL] [PI] [EM]" /x /t " " /f input.txt
Dave Benham
foxidrive wrote:Aacini and dbenham, you two blokes have created brilliant tools with these Jscript enhanced batch files.
If I had any sway in Microsoft then I'd get them included in a Windows Update patch so that administrators and enthusiasts everywhere can benefit.
Below I have a suggestion to help people use your tools, because there is a fair amount of chatter and questions in the main threads,
if you both think it is worthwhile then I'd suggest that you create dedicated threads called something like:
FindRepl: Examples and tutorials
FindRepl: Code
FindRepl: Discussion
Jrepl: Examples and tutorials
Jrepl: Code
Jrepl: Discussion
The current threads can be renamed to the : Discussion threads.
In the Example threads you'd keep all the samples of code, and explanations of how they can be used
A Code thread can have a history of the code releases with a LARGE message at the top to see the last post for the most recent version, and all linked appropriately to the other threads.
- and the mods here can move any posts with conversations/questions to the Discussion threads.
It might make the threads easier to maintain, plus searchers can browse the appropriate threads for the valuable tips and tricks that many of us need to effectively use your gems.
There's some initial work to get it set up but I'm also willing to help if needed.