I’m a beginner in programming TCL and want to delete lines from an input file matching
- exactly the same line content
- pattern:
"ghi\/\njkl\/\nrccu1" -> "Point \.*: 10 Sinks" \.*
(number behind word “Point” and content behind “[color.*” can be different – all other need to match exactly) "mno\/\npqr\/\nrccu1" -> "stu\/\nvwx\/\nrccu1" [label = "depth: 1"] [color=salmon] [fontcolor=salmon] [style=solid];
(number behind word “Point” and content behind “[color.*” can be different – all other need to match exactly)
Now I have following input file
"abc\/\ndef\/\nrccu1" [shape=octagon,color=red,style=filled]; "abc\/\ndef\/\nrccu1" [shape=octagon,color=red,style=filled]; "ghi\/\njkl\/\nrccu1" -> "Point 1: 10 Sinks" [color=salmon] [style=solid] [weight=8]; "123\/\n456\/\nrccu1" -> "Point 9: 10 Sinks" [color=grey] [style=solid] [weight=8]; "ghi\/\njkl\/\nrccu1" -> "Point 8: 10 Sinks" [color=grey] [style=solid] [weight=8]; "ghi\/\njkl\/\nrccu1" -> "Point 13: 20 Sinks" [color=grey] [style=solid] [weight=8]; "mno\/\npqr\/\nrccu1" -> "stu\/\nvwx\/\nrccu1" [label = "depth: 1"] [color=salmon] [fontcolor=salmon] [style=solid]; "mno\/\npqr\/\nrccu1" -> "stu\/\nvwx\/\nrccu1" [label = "depth: 4"] [color=salmon] [fontcolor=salmon] [style=solid]; "mno\/\npqr\/\nrccu1" -> "stu\/\nvwx\/\nrccu1" [label = "depth: 1"] [color=grey] [fontcolor=red] [style=solid];
Output file should contain:
"abc\/\ndef\/\nrccu1" [shape=octagon,color=red,style=filled]; "ghi\/\njkl\/\nrccu1" -> "Point 1: 10 Sinks" [color=salmon] [style=solid] [weight=8]; "123\/\n456\/\nrccu1" -> "Point 9: 10 Sinks" [color=grey] [style=solid] [weight=8]; "ghi\/\njkl\/\nrccu1" -> "Point 13: 20 Sinks" [color=grey] [style=solid] [weight=8]; "mno\/\npqr\/\nrccu1" -> "stu\/\nvwx\/\nrccu1" [label = "depth: 1"] [color=salmon] [fontcolor=salmon] [style=solid]; "mno\/\npqr\/\nrccu1" -> "stu\/\nvwx\/\nrccu1" [label = "depth: 4"] [color=salmon] [fontcolor=salmon] [style=solid];
1 Answer