Need replace utility which uses wildchars

  • Thread starter Thread starter JN
  • Start date Start date
J

JN

Hi. I seek a simple utility which can replace text in file using
wildchar patterns. Example:

1453 516.22478751 lab.exe:236
1454 516.22481572 lab.exe:236
1455 516.22484310 lab.exe:237
1456 516.22487048 lab.exe:236

I want replace this pattern:

???? ???.???????? lab.exe:236

with this

xxxx xxx.xxxxxxxx lab.exe:xxx

The result should be this

xxxx xxx.xxxxxxxx lab.exe:xxx
xxxx xxx.xxxxxxxx lab.exe:xxx
1455 516.22484310 lab.exe:237
xxxx xxx.xxxxxxxx lab.exe:xxx

Does anybody know something like this? Thanks.
 
(e-mail address removed) (JN) wrote:
Hi. I seek a simple utility which can replace text in file using
wildchar patterns. Example:

I want replace this pattern:
???? ???.???????? lab.exe:236
with this
xxxx xxx.xxxxxxxx lab.exe:xxx
The result should be this
xxxx xxx.xxxxxxxx lab.exe:xxx
xxxx xxx.xxxxxxxx lab.exe:xxx
1455 516.22484310 lab.exe:237
xxxx xxx.xxxxxxxx lab.exe:xxx

I not sure that I understand the logic.

Is "lab.exe:236" the key to the fact that you want all numerals in the
current line replaced by the character x?

Or, is "236" a simplier key?

fubar your.txt 236 (produces:)

xxxx xxx.xxxxxxxx lab.exe:xxx
xxxx xxx.xxxxxxxx lab.exe:xxx
1455 516.22484310 lab.exe:237
xxxx xxx.xxxxxxxx lab.exe:xxx

If so, nothing comes to mind, but it might exist. Maybe someone else
has tried something like this and know of an existing utility. What
operating system are you using in this venture?

If not, it will be very easy to write. Give it a day and see what
replies you get. Remove the three caps and email me if you don't find
what you're looking for.
 
JN said:
Hi. I seek a simple utility which can replace text in file using
wildchar patterns. Example:

[...]


GNU Awk

Homepage:
http://www.gnu.org/software/gawk/gawk.html

Download:
http://prdownloads.sourceforge.net/gnuwin32/gawk-3.1.0-2-bin.zip

Documentation:
http://prdownloads.sourceforge.net/gnuwin32/gawk-3.1.0-2-doc.zip

Online Users Guide:
http://www.gnu.org/manual/gawk/index.html


Also have a look at the thread 'csv command line editing' for additional
info:
http://groups.google.com/groups?hl=...=Google+Suche&as_epq=CSV+command+line+editing

HTH,
Jörg
 
It said:
Hi. I seek a simple utility which can replace text in file using
wildchar patterns. Example:

1453 516.22478751 lab.exe:236
1454 516.22481572 lab.exe:236
1455 516.22484310 lab.exe:237
1456 516.22487048 lab.exe:236

I want replace this pattern:

???? ???.???????? lab.exe:236

with this

xxxx xxx.xxxxxxxx lab.exe:xxx

The result should be this

xxxx xxx.xxxxxxxx lab.exe:xxx
xxxx xxx.xxxxxxxx lab.exe:xxx
1455 516.22484310 lab.exe:237
xxxx xxx.xxxxxxxx lab.exe:xxx

Any text editor with support for regular expressions will do it, for
example SciTE:
<http://www.scintilla.org/SciTE.html>

Or, if you don't like SciTE for any reason, there are many more
editors listed on NoNags:
<http://www.nonags.com/nonags/texted32.html>

Just make sure the editor you are going to use has support for
regular expressions (and RTFM).

HTH
 
Just make sure the editor you are going to use has support for
regular expressions (and RTFM).
Slightly OT, but if you are not already familiar with regular
expressions, you may find this of interest: Regular Expressions
Tutorial by David Mertz

http://gnosis.cx/publish/programming/regular_expressions.html

If you are actually trying to rename the files themselves, you may
find Oscar's Renamer handy as you can cut and paste entire file names
as long as you maintain the order.

http://www.mediachance.com/free/index.html

Good luck,
BillR
 
rir3760 said:
It was a dark and stormy night when (e-mail address removed) (JN) wrote:
[snip]

If you are actually trying to rename the files themselves, you may
find Oscar's Renamer handy as you can cut and paste entire file names
as long as you maintain the order.

http://www.mediachance.com/free/index.html

Just a quick question re Oscar's - it's now stopped working several
installations ago (a third of this type) re opening at the pertinent
folder. I always now must travel to the folder that has all the file
sto be renamed. At first, it was only the desktop this wouldn't work
on.

I have never gotten used to this first limitation and now for months,
it doesn't even do what it did before (go figure). This would not be
a problem if a file open dialogue box could be opened to put the path
where the files are to rename or to dump the files in via drag 'n drop
but none of these things are present.

I did email the developer more than once and not once received a
reply.

My question is: is there any way to go in and fix it so that Oscar's
open up at the right folder. I currently have it associated with all
files via Context Edit but this does not launch the program with the
folder the doct. that launched it was contained in. Fiddling with the
different possible "switches" in Context Edit doesn't change that
fact. Half of Oscar's speed and value has been lost to me for some
time now.

Does anyone think there might be a way to manually overcome this
limitation via some sort of registry fix? I wonder why the
registering doesn't work to begin with.

p.s., I have Win98SE. Cheers!
 
Thank you all for you suggestions. I found out, that even classic MS
Word has this feature. In Search and Replace dialog there is button
'Special' by which you can enter a special characters. For example ^#
means every possible number.
 
(e-mail address removed) (BillR) wrote:
Slightly OT, but if you are not already familiar with regular
expressions, you may find this of interest: Regular Expressions
Tutorial by David Mertz

I found it useful. As many times as I've heard the term I had no idea
what it meant. Thanks Bill!

------------ And now a word from our sponsor ------------------
For a quality usenet news server, try DNEWS, easy to install,
fast, efficient and reliable. For home servers or carrier class
installations with millions of users it will allow you to grow!
---- See http://netwinsite.com/sponsor/sponsor_dnews.htm ----
 
I found it useful. As many times as I've heard the term I had no idea
what it meant. Thanks Bill!
This field has so many terms specific to (or derived from) a
particular OS or product that are borrowed from standard language that
I sometimes wonder if the field will founder under their weight. I
once counted 8 different definitions of "record" in the documentation
of an OS and its standard utilities. A different reviewer could
easily have arrived at 6 -- or 16.

I'm glad to return a favor by contributing something you found useful
-- especially since it was a bit OT of the OP. I also hesitated
because some people here are so vocal about classifying help files and
the like as OT.

All this controversy is so tiresome. Maybe the nomination and
subsequent discussion of which program is best based on its merits
(quite a novel concept of late) will displace the dissension.

BillR
 
BillR said:
Slightly OT, but if you are not already familiar with regular
expressions, you may find this of interest: Regular Expressions
Tutorial by David Mertz

http://gnosis.cx/publish/programming/regular_expressions.html


To bring it a bit more on-topic *g*

There is also The Regex Coach : http://weitz.de/regex-coach/

The Regex Coach is a graphical application for Linux and Windows which
can be used to experiment with (Perl-compatible) regular expressions
interactively. It has the following features:

+ It shows whether a regular expression matches a particular target
string.
+ It can also show which parts of the target string correspond to
captured register groups or to arbitrary parts of the regular
expression.
+ It can "walk" through the target string one match at a time.
+ It can simulate Perl's split and s/// (substitution) operators.
+ It tries to describe the regular expression in plain English.
+ It can show a graphical representation of the regular expression's
parse tree.
+ It can single-step through the matching process as performed by
the regex engine.
+ Everything happens in "real time", i.e. as soon as you make a
change somewhere in the application all other parts are instantly
updated.
 
(Fitwell, I'm quoting the entirety, this time 'round. Mainly in case there's
something I overlooked, then you can have it still there to include back.)


fitwell said:
Just a quick question re Oscar's - it's now stopped working several
installations ago (a third of this type) re opening at the pertinent
folder. I always now must travel to the folder that has all the file
sto be renamed. At first, it was only the desktop this wouldn't work
on.

I have never gotten used to this first limitation and now for months,
it doesn't even do what it did before (go figure). This would not be
a problem if a file open dialogue box could be opened to put the path
where the files are to rename or to dump the files in via drag 'n drop
but none of these things are present.

I did email the developer more than once and not once received a
reply.

My question is: is there any way to go in and fix it so that Oscar's
open up at the right folder. I currently have it associated with all
files via Context Edit but this does not launch the program with the
folder the doct. that launched it was contained in. Fiddling with the
different possible "switches" in Context Edit doesn't change that
fact. Half of Oscar's speed and value has been lost to me for some
time now.

Does anyone think there might be a way to manually overcome this
limitation via some sort of registry fix? I wonder why the
registering doesn't work to begin with.

p.s., I have Win98SE. Cheers!

Hi Fitwell,

I downloaded and looked at Oscar's, and believe I see the problem. It does
a context extension, via a DLL, with a CLSID entry in the registry.

So no matter what switches you try manually with something like Context Edit,
pointing at Oscar's exe, can't expect to get joy that way. You should delete
out anything you've added pointing to that exe.

Then next, register the DLL, or same effect: use the menu option in Oscar
to register the DLL. The result will enter a pair of reg keys, with CLSID,
pointing at that DLL.

.. . . . .

This context menu extension, it's not as you were used to, where you have
an EXE that is what is supporting the input. An example for what you had been
expecting would be in the case of the renamer that I keep on my context menu.
Albert Bertilsson's Renamer.

It does a context menu entry for directories. Pointing at its exe.

[HKCR\Directory\shell\Renamer\command]
@="D:\\SYSUTILS\\FILETOOLS\\REN\\abrenamer\\renamer.exe %0"

.. . . . .

Oscar, on the other hand, it does things by the DLL+CLSID. Also, note that
Oscar's docs said it doesn't support folders for the context starting point,
just files. Its point of entry is for "all files" -- aka HKCR\*

The regkey pair that it automatically creates when you enable it... First,
notice that it's for the "all files" context menu of explorer:

[HKCR\*\shellex\ContextMenuHandlers\Renamer]
@="{01553CB6-B7D7-4C84-8C92-7738A567C0D6}"

Then, since a CLSID action entry needs a definition, this lands in the
correspondent location, [HKCR\CLSID\...], with a pointer to the file:

[HKCR\CLSID\{01553CB6-B7D7-4C84-8C92-7738A567C0D6}\InProcServer32]
@="D:\\SYSUTILS\\FILETOOLS\\REN\\oscar\\ctxmenu.dll"

.. . . . .

You don't need to read that third part (if it's boring). Just know that
it's a DLL doing things in this kind of case, so you can't do the same kind
of things as with when it's an exe, like point at it via sendto or manually
created context-menu options.

Also, note encore, that Oscar states only supporting "Renamer" as context menu
item for files, not directories. That other util, which I brought up earlier,
Bertilsson's, it's one that supports on the context menu for directores, and
drives too. (Maybe or maybe not for files, that one, can't remember, as I'd
deleted all but one of its context menu entries some time back.)

Any case, I hope the explain is clear? It is sort of a visual thing. I mean,
when you're looking right at such entries, and are used to looking at them,
it's different from just coming in and then reading straight text talk about
them; but maybe you got what I was talking about in any case. :)
 
I wonder why the registering doesn't work to begin with.

I have assumed you are running latest version, yes? I see that it says:
"The 1.1 fixes the Shell Extension registration process."

I even considered that you'd moved the install directory. But if so,
that'd be no matter, when you just re-register the DLL.

My advice. Register it again. You know how illogical computers are; they
sometimes want you to do the exact same steps any number of times, before
the whim strikes them to accept the changes.
 
Back
Top