Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pro 1 file.txt
- proc pro { pattern args} {
- set file [open $args r]
- set lnum 0
- set occ 0
- while {[gets $file line] >=0} {
- incr lnum
- if {[regexp $pattern $line]} {
- incr occ
- puts "The pattern is present in line: $lnum"
- puts "$line"
- } else {
- puts "not found"
- }
- }
- puts "total number of occurencese : $occ"
- close $file
- }
- proc pro { pattern args} {
- set file [open $args r]
- set lnum 0
- set occ 0
- while {[gets $file line] >=0} {
- incr lnum
- if {[regexp $pattern $line]} {
- incr occ
- puts "The pattern is present in line: $lnum"
- puts "$line"
- } else {
- puts "not found"
- }
- }
- puts "total number of occurencese : $occ"
- close $file
- }
- proc pro { pattern args} {
- set file [open $args r]
- set lnum 0
- set occ 0
- while {[gets $file line] >=0} {
- incr lnum
- if {[regexp $pattern $line]} {
- incr occ
- puts "The pattern is present in line: $lnum"
- puts "$line"
- } else {
- puts "not found"
- }
- }
- puts "total number of occurencese : $occ"
- close $file
- }
- regexp "^$lineNo\." $a
- if {[regexp "\m$pattern\M" $line]} { ...
- if { [string range $line 0 [string length $pattern]] eq "${pattern}." } {
- ...
- }
Add Comment
Please, Sign In to add comment