Menu

#5 -p,-b flags, functionality

open
nobody
None
5
2009-07-15
2009-07-15
Balderstrom
No

I was going to ask about how to stop %variable% expansion, but I figured out just to unset the variables, and that works fine, ie: %ProgramFiles%.

But I am confused as to the functionality of the -p preview and -b backup flags.

With the command: fart -V -i -p *.bar "%ProgramFiles%\TotalCmd\data"
I get exactly what I expect, showing lines where that string occurs, and then:
> Found 14 occurence(s) in 5 file(s).

With the command: fart -V -i -p *.bar "%ProgramFiles%\TotalCmd\data" "%AppData%\GHISLER"
I would of expected output to be what the lines would look like after replacement, instead I get:
FART: --verbose
FART: --ignore-case
FART: --preview
FART: wild_card="*.bar"
FART: find_string="%ProgramFiles%\TotalCmd\data"
FART: replace_string="%AppData%\GHISLER"
FART: processing ,*.bar
___1QV.BAR
___cutCopyPaste.bar
___myPC-TabRoot.bar
___myPC.bar
___myPC2.bar
Replaced 0 occurence(s) in 5 file(s).

Am I missing something? I don't see any use for the -p preview command in regards to actual replacement.

Also the -b backup flag doesn't seem to do anything, and when you use it there is a large discrepancy in what is actually occuring. No replacements occur, no backups are created and Fart claims it has done the replacements::

fart -V -i -b *.bar "%ProgramFiles%\TotalCmd\data" "%AppData%\GHISLER"
FART: --verbose
FART: --ignore-case
FART: --backup
FART: wild_card="*.bar"
FART: find_string="%ProgramFiles%\TotalCmd\data"
FART: replace_string="%AppData%\GHISLER"
FART: processing ,*.bar
___1QV.BAR
Error: could not remove: ___1QV.BAR.bak
___cutCopyPaste.bar
Error: could not remove: ___cutCopyPaste.bar.bak
___myPC-TabRoot.bar
Error: could not remove: ___myPC-TabRoot.bar.bak
___myPC.bar
Error: could not remove: ___myPC.bar.bak
___myPC2.bar
Error: could not remove: ___myPC2.bar.bak
Replaced 14 occurence(s) in 5 file(s).

If I run the same command without -b, all replacements occur, and everything is fine. Just no backups of the files in question.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB