How to do things
AI Noob vs. Pro

List biggest files
List newest files
Show subdir sizes
Search in files
Replace word in files
List dir differences
Send files in LAN

Free Open Source:

Swiss File Knife

a command line
multi function tool.

remove tabs
list dir sizes
find text
filter lines
find in path
collect text
instant ftp or
http server
file transfer
send text
patch text
patch binary
run own cmd
convert crlf
dup file find
md5 lists
fromto clip
hexdump
split files
list latest
compare dirs
save typing
trace http
echo colors
head & tail
dep. listing
find classes
speed shell
zip search
zip dir list

Depeche View
Source Research
First Steps

windows GUI
automation

command line
file encryption

free external tools,
zero install effort,
usb stick compliant:

zip and unzip
diff and merge
reformat xml
reformat source

cpp sources

log tracing
mem tracing
hexdump
using printf

articles

embedded
stat. c array
stat. java array
var. c array
var. java array
view all text
as you type
surf over text
find by click
quick copy
multi view
find nearby
fullscreen
bookmarks
find by path
expressions
location jump
skip accents
clip match
filter lines
edit text
highlight
load filter
hotkey list
receive text
send in C++
send in Java
smooth scroll
touch scroll
fly wxWidgets
fly over Qt
search Java

echo text with colours in your batch files, with the free sfk echo command for Windows, Mac OS X, Linux and Raspberry Pi.
  • 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-64.exe sfk and chmod +x sfk then ./sfk
  • Linux: type mv sfk-linux-64.exe sfk and chmod +x sfk then ./sfk. OS X and Linux syntax may differ, check the help within the tool.
sfk echo [options] string [string2] [string3] [...]
sfk tell [-spat] string [string2] [string3] [...]

prints the supplied string, which may contain color patterns:

    [Red],[Green],[Blue],[Yellow],[Cyan],[Magenta]   (bright)
    [red],[green],[blue],[yellow],[cyan],[magenta]   (dark)
      print the following text in the selected color.

    [def]
      switch back to default color.

    [[ print the '[' character, no not interpret the following word.
    ]] print the ']' character, do not interpret it.

options:
   -literal  or -lit disables everything, even color patterns,
             i.e. words in brackets like [red] are not changed.
   -noline   stay in the same line, print no linefeed.
             if your string ends with \r, -noline is assumed.
             for command chaining -noline requires -literal
             and a command accepting binary data, like xed:
                sfk echo -lit -noline "%1" +xed ...
   -pure     same as -literal -noline. use this always to send
             chain input data as unchanged as possible, like
             filenames from parameters, to following commands:
                sfk echo -pure "%1" +xed "_/_\\_" ...
   -stream   no extra linefeeds, no colors, binary transfer.
             best for following +setvar or +xed commands.
   -spat     activates slash patterns: \t=TAB \q=" \r=CR \n=LF
             \xnn = any code with hex value nn. can be given
             after -lit to use slash patterns without colors.
   -join[line]  join all into one line. line ends are stripped
             from quoted multi line parms (full trim). multiple
             string parameters are joined without blanks.
   -lines    print every given string as a single line.

command chaining support

   sfk tell  just prints to terminal, and never sends text
             to a following command. always prefer this
             if you just want to print an info to terminal.

   sfk echo  will send the given text to a following command
             if it accepts text or filename list input.

   by default, echo produces only text data, not filenames.
   to send this to file commands use +texttofilenames or +ttf.
   echo -lines may produce filename lists directly.

quoted multi line parameters are supported in scripts
   using auto indent. type "sfk script" for details.
   use option -joinline to apply full trim.

see also: sfk help colors

web reference
   http://stahlworks.com/sfk-echo

examples
   sfk tell "[Red]error:[def] missing filename."
      prints "error: missing filename." onto terminal.

   sfk tell [Cyan]NOTE:[def] type the word [[red]] with brackets!
      prints "NOTE: type the word [red] with brackets!" onto terminal.

   sfk echo "[Green]mytext contains:[def]" +then filter mytext.txt
      +then forces echo not to pass its text to filter, but to
      print it immediately. filter then prints the content of mytext.

   sfk tell "[Green]mytext contains:[def]" +filter mytext.txt
      same as above, but shorter. tell never sends text to following
      commands therefore +then is not required.

   sfk tell -nocconv -spat "\xc9\xcd\xbb\n\xba \xba\n\xc8\xcd\xbc\n"
      print a graphical box using extended dos characters.
      more infos under sfk ascii -dos and sfk help opt

   sfk echo -spat "foo\nand\nbar" +tofile mydir\test1.txt
      create a small text file with three text lines

   sfk tell -spat "\x2b++foo+++"
      print the word 'foo' surrounded by plus characters.
      first plus must be masked as \x2b otherwise sfk thinks
      it is the next chain command.

   sfk echo -pure "C:\in.txt" +xed -dump
      send the string C:\in.txt as unchanged as possible to xed
      and create a hexdump, to check that no (CR)LF was added.

   sfk echo -pure -spat "foo\tbar" +xed -dump
      send the word "foo" followed by tab character then "bar"
      to xed and create a hexdump. "\t" is changed by -spat.

   sfk echo -lines 100 101 102 +perline "web .$text/status.xml"
      load page /status.xml from three local ip's .100, .101, .102
 
sfk color colorname

   switches the text color of terminal (command line).
   supported color names are:

      white  
      grey   
      red    
      green  
      blue   
      yellow 
      cyan   
      magenta
      black  
sfk echo [options] string [string2] 
   [string3] [...]
sfk tell [-spat] string [string2] 
   [string3] [...]

prints the supplied string, which may 
contain color patterns:

    [Red],[Green],[Blue],[Yellow],
    [Cyan],[Magenta] (bright) [red],
    [green],[blue],[yellow],[cyan],
    [magenta] (dark)
      print the following text in the 
      selected color.

    [def]
      switch back to default color.

    [[ print the '[' character, no not 
  interpret the following word.
    ]] print the ']' character, do not 
  interpret it.

options:
   -literal  or -lit disables everything, 
                 even color patterns,
             i.e. words in brackets like 
             [red] are not changed.
   -noline   stay in the same line, print 
             no linefeed. if your string
             ends with \r, -noline is
             assumed. for command chaining
             -noline requires -literal and
             a command accepting binary
             data, like xed:
                sfk echo -lit -noline "%1" 
                           +xed ...
   -pure     same as -literal -noline. use 
                      this always to send
             chain input data as unchanged 
             as possible, like filenames
             from parameters, to following
             commands:
                sfk echo -pure "%1" +xed 
                           "_/_\\_" ...
   -stream   no extra linefeeds, no colors, 
             binary transfer. best for
             following +setvar or +xed
             commands.
   -spat     activates slash patterns: \
             t=TAB \q=" \r=CR \n=LF \xnn =
             any code with hex value nn.
             can be given after -lit to use
             slash patterns without colors.
   -join[line]  join all into one line. 
                line ends are stripped
             from quoted multi line parms 
             (full trim). multiple string
             parameters are joined without
             blanks.
   -lines    print every given string as a 
             single line.

command chaining support

   sfk tell  just prints to terminal, and 
             never sends text to a
             following command. always
             prefer this if you just want
             to print an info to terminal.

   sfk echo  will send the given text to 
             a following command if it
             accepts text or filename list
             input.

   by default, echo produces only text data,
   not filenames. to send this to file
   commands use +texttofilenames or +ttf.
   echo -lines may produce filename lists
   directly.

quoted multi line parameters are supported 
in scripts
   using auto indent. type "sfk script" for 
   details. use option -joinline to apply
   full trim.

see also: sfk help colors

web reference
   http://stahlworks.com/sfk-echo

examples
   sfk tell "[Red]error:[def] missing 
   filename."
      prints "error: missing filename." 
    onto terminal.

   sfk tell [Cyan]NOTE:[def] type the word 
   [[red]] with brackets!
      prints "NOTE: type the word [red] 
    with brackets!" onto terminal.

   sfk echo "[Green]mytext contains:[def]" 
   +then filter mytext.txt
      +then forces echo not to pass its 
    text to filter, but to
      print it immediately. filter then 
      prints the content of mytext.

   sfk tell "[Green]mytext contains:[def]" 
   +filter mytext.txt
      same as above, but shorter. tell 
      never sends text to following
      commands therefore +then is not
      required.

   sfk tell -nocconv -spat "\xc9\xcd\xbb\n\
                       xba \xba\n\xc8\xcd\
                       xbc\n"
      print a graphical box using extended 
      dos characters. more infos under sfk
      ascii -dos and sfk help opt

   sfk echo -spat "foo\nand\nbar" +tofile 
              mydir\test1.txt
      create a small text file with three 
      text lines

   sfk tell -spat "\x2b++foo+++"
      print the word 'foo' surrounded by 
      plus characters. first plus must be
      masked as \x2b otherwise sfk thinks
      it is the next chain command.

   sfk echo -pure "C:\in.txt" +xed -dump
      send the string C:\in.txt as 
      unchanged as possible to xed and
      create a hexdump, to check that no
      (CR)LF was added.

   sfk echo -pure -spat "foo\tbar" 
                    +xed -dump
      send the word "foo" followed by tab 
      character then "bar" to xed and
      create a hexdump. "\t" is changed by
      -spat.

   sfk echo -lines 100 101 102 +perline 
              "web .$text/status.xml"
      load page /status.xml from three 
      local ip's .100, .101, .102
 
sfk color colorname switches the text color of terminal (command line). supported color names are: white grey red green blue yellow cyan magenta black

you are viewing this page in mobile portrait mode with a limited layout. turn your device right, use a desktop browser or buy the sfk e-book for improved reading.

 
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).

 

the Endless Image 🍣 Sushi