Guest User

Untitled

a guest
Jul 20th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. pro 1 file.txt
  2.  
  3. proc pro { pattern args} {
  4.  
  5. set file [open $args r]
  6. set lnum 0
  7. set occ 0
  8. while {[gets $file line] >=0} {
  9. incr lnum
  10. if {[regexp $pattern $line]} {
  11. incr occ
  12. puts "The pattern is present in line: $lnum"
  13. puts "$line"
  14. } else {
  15. puts "not found"
  16. }
  17. }
  18. puts "total number of occurencese : $occ"
  19. close $file
  20. }
  21.  
  22. proc pro { pattern args} {
  23.  
  24. set file [open $args r]
  25. set lnum 0
  26. set occ 0
  27. while {[gets $file line] >=0} {
  28. incr lnum
  29. if {[regexp $pattern $line]} {
  30. incr occ
  31. puts "The pattern is present in line: $lnum"
  32. puts "$line"
  33. } else {
  34. puts "not found"
  35. }
  36. }
  37. puts "total number of occurencese : $occ"
  38. close $file
  39. }
  40.  
  41. proc pro { pattern args} {
  42.  
  43. set file [open $args r]
  44. set lnum 0
  45. set occ 0
  46. while {[gets $file line] >=0} {
  47. incr lnum
  48. if {[regexp $pattern $line]} {
  49. incr occ
  50. puts "The pattern is present in line: $lnum"
  51. puts "$line"
  52. } else {
  53. puts "not found"
  54. }
  55. }
  56. puts "total number of occurencese : $occ"
  57. close $file
  58. }
  59.  
  60. regexp "^$lineNo\." $a
  61.  
  62. if {[regexp "\m$pattern\M" $line]} { ...
  63.  
  64. if { [string range $line 0 [string length $pattern]] eq "${pattern}." } {
  65. ...
  66. }
Add Comment
Please, Sign In to add comment