TransWikia.com

Use sed to replace $ in a tcl script

Super User Asked by user1200908 on December 1, 2021

I have a file which contains following:

@$test123
@$test456
$test789

In tcl shell, I want to replace ^$,
I tried following but it doesnt seem to work:

eval exec grep test file | sed s/^$//
@$test123
@$test456
$test789

I should see the $test789 replaced with just test789

One Answer

Since $ has a special meaning in a regex (line end/file end), it has to be quoted or provided as character class.

This does what you want:

sed -e 's/^[$]//g'

Answered by fratester on December 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP