Swiss File Knife
a command line
free external tools,
- download the free Swiss File Knife Base from Sourceforge. - open the Windows CMD command line, Mac OS X Terminal or Linux shell. - OS X : type mv sfk-mac-i686.exe sfk and chmod +x sfk then ./sfk - Linux: type mv sfk-linux.exe sfk and chmod +x sfk then ./sfk OS X and Linux syntax may differ, check the help within the tool.
sfk [f]script [opts] file [-from=label] [parm1] [parm2] [...] execute sfk command(s) from a script file, which can be - an absolute filename, e.g. C:\scripts\thescript.txt - a relative filename. in this case, the file is searched in the current dir "." first, and then in the PATH. parameters: - if "-from=label" is given, the script file is searched for a statement "label mylabel", and script execution runs from this point until +end is reached. - all other words after -from, or instead of from, are passed as parameters to the script, with one exception: a word starting with a "+" continues the sfk command chain. if you need to pass words starting with "+" to the script, set option -literal (disallowing further chain commands). command chaining: with ... +script name, text data is passed to the script. with ... +fscript name, filenames are passed to the script. script file syntax: - lines having // as first text are ignored. - command line parameters 1 to 9 can be addressed both by expressions %1 to %9, or $1 to $9. - character # at column 1 of any line is skipped, which allows bash-embedded scripts to have sfk statements outcommented if necessary. - escaped quotes \" are changed into normal quotes " - line ends are ignored. in general, lines are combined into one large command chain, just like typing them all into one line of unlimited length. - any whitespace is skipped unless surrounded by quotes " however this may or may not apply with the following: about quoted multi line parameters: a command in a script like +echo " Help chapter 01 --------------- The quick brown fox " gets one large parameter spread across multiple lines, called a quoted multi line parameter. this contains many whitespaces at line starts, and invisible end of line characters at line ends, which often cause commands like echo, run or (x)replace not to work as expected. - add option -qtrim after "sfk label labelnam" to have whitespaces reduced automatically depending on command. this is default since SFK 1.8.0. sfk will auto apply one of these trimming modes: full trim : all whitespace and eol are dropped. -> used with most commands parm trim : single blank is left between words. -> used with run auto indent: some blanks and eol are kept to keep an indentation relative to 1st line. -> used with echo - add option -qraw after "sfk label labelnam" to keep all whitespace as it is. this is no longer default since SFK 1.8.0, and may be required with old scripts. you may also set SFK_CONFIG=qraw also type "sfk label" for infos. parameter name collisions: if your script contains commands like +filter -form "$10.10col1 ..." then "$1" will be misinterpreted as an input parameter into the script. to avoid this use one of +filter -form "$(10.10col1) ..." or +filter -form "$$10.10col1 ..." or disable $ as a parameter name prefix by option -prefix. see "sfk label" for more on that. options -verbose tell in detail which words are used from script. -literal also pass words to the script that start with "+". see also sfk help chain command chaining overview sfk help var about script parameters and variables sfk label further options given after label sfk load load text or data for chaining setting global options for all commands within a script: supply them directly after "sfk" of the calling command: sfk -var script myscript.txt -from=mylabel runs myscript.txt with sfk variable support active in every command. some options like -var can also be given after sfk label. see "sfk label" for more. for script examples, type: sfk samp sfk - create sfk sample script sfk samp sfkbat - sample script embedded in windows batch sfk samp sfkbash - sample script embedded in bash script sfk samp - more about the sfk sample syntax more in the SFK Book the SFK Book contains a 60 page tutorial, including long script examples with input, output and explanations. type "sfk book" for details. web reference http://stahlworks.com/sfk-script recommended use: if you want to create an easy-to-use script on the fly, 1. create an embedded script in a batch file: sfk batch myscript.bat 2. edit myscript.bat with any text editor. 3. run the script by typing "myscript.bat".
sfk is a free open-source tool, running instantly without installation efforts. no DLL's,
no registry changes - just get sfk.exe from the zip package and use it (binaries for
windows, linux and mac are included).
read more about all sfk functions here.