Reputation: 519
I am using tcl 8.5.
I want to cut every line not ending with ,
or "
in my input.
input
karthik*
software engineer,
I tried ,
regsub -all {[^",]\n} $content {} content
expected output
karthik*software engineer,
output
karthiksoftware engineer,
The character *
is missing .I understand [^,"]
in regsub matches * and it is cut.
But how can i cut only \n
and not *
?
Upvotes: 0
Views: 179
Reputation: 247210
It's because you're throwing out the char before the newline along with the newline.
regsub -all {([^",])\n} $content {\1} content
# ...........^.....^..............^^
Upvotes: 4