Posted to tcl by lmcvoy at Mon Oct 22 15:27:13 GMT 2007view raw

  1. # perl
  2. $re = '^\$/';
  3. while (<>) {
  4. print if /$re/o;
  5. }
  6.  
  7. # tcl
  8. set re {^\$/}
  9. fconfigure stdout -encoding binary -translation binary
  10. foreach file $argv {
  11. set f [open $file r]
  12. fconfigure $f -encoding binary -translation binary
  13. while {[gets $f buf] >= 0} {
  14. if {[regexp -- $re $buf]} {puts $buf}
  15. }
  16. close $f
  17. }
  18.