Hi, please respect for **** thanks
I need via batch (windows) to remove a particularry string from a input.txt like:
so that a the same input.txt file becomes have to be cutted the exactly string %use_choice% /C:12 /T:1,%timeout% /M:msg " PANPOT AUDIO " like this:Code:Hi cats %use_choice% /C:12 /T:1,%timeout% /M:msg " PANPOT AUDIO " la bla bla
is it possible? thanksCode:Hi cats la bla bla
+ Reply to Thread
Results 1 to 9 of 9
Find And Replace Text command line utility. New & improved version of the well-known grep command, with advanced features such as: case-adaption of the replace string; find (& replace) in filenames. Latest version is: 1.98 Find And Replace Text v1.98 by Lionello Lunesu Usage: FART [options] [--] <wildcard>[,...] [find_string] [replace_string] Options: -h --help Show this help message (ignores other options) -q --quiet Suppress output to stdio / stderr -V --verbose Show more information -r --recursive Process sub-folders recursively -c --count Only show filenames, match counts and totals -i --ignore-case Case insensitive text comparison -v --invert Print lines NOT containing the find string -n --line-number Print line number before each line (1-based) -w --word Match whole word (uses C syntax, like grep) -f --filename Find (and replace) filename instead of contents -B --binary Also search (and replace) in binary files (CAUTION) -C --c-style Allow C-style extended characters (\xFF\0\t\n\r\\ etc.) --cvs Skip cvs dirs; execute "cvs edit" before changing files -a --adapt Adapt the case of replace_string to found string -b --backup Make a backup of each changed file -p --preview Do not change the files but print the changes
Q. How do cats FART ?
A. Very loudly.
(must be the craziest name of an utility)
something of more specific?
loading the file in a textf wditor like notepad++ and doing the search and replace is the easiest .
the usage syntax for fart is specified above..
So how does it look like in batch script? In PS it looks like so:
Desktop> (gc .\cats.txt -raw) -replace ' %use_choice% /C:12 /T:1,%timeout% /M:msg " PANPOT AUDIO "\r\n', '' Hi cats la bla bla
cli may have problems since text have percent sogns andquotation marks.. so match may work or not..since dos interprets them as somrhing else..
you may need to escape a lot of these literals
I don't know how to do it because I never learned batch scripts as I always found it too cryptic and too limited, mkvtoolnix seem to use ^ all over the place and I really never understood why it is doing it because I didn't need a single time in my whole life I think, I know some basic cmd stuff but nothing advanced, staxrip actually runs cmd because encoders use piping, it uses cmd by passing commands on the command line, it does not use batch scripts because unicode in batch scripts work only in win 10 and it's difficult to do from code, also batch scripts are not needed, command line is sufficient. What I don't get is how popular batch script still is considering how bad it is compared to powershell (exist way over a decade) and also compared to bash (which can also be used on windows I think). What I do understand is powershell is by no means easy to master, even for somebody like me doing .NET coding since day one. I learned about powershell in small bits over the years, learned a few things about the command line from working on staxrip and only after working on mpv.net I realized that the command line is actually a cool thing, so now I learn more about it and what is awesome is the new windows terminal, apparently Microsoft has also noticed that's a cool thing. Really confident about my command line knowledge I became after I implemented command line features in mpv.net and after I started to learn powershell more seriously, writing my first advanced function this week.