writing 0's and 1's

S

Sridhar_Gadda

Guest
Hello,

I have a textedit file with values 0's and 1's. I want to change
the value of zero to +1 and the value of 1 to -1. and write back to the
file again.

Any help can be appreciated.

Thanks in advance.

Sridhar
 
Sridhar_Gadda wrote:
I have a textedit file with values 0's and 1's. I want to change
the value of zero to +1 and the value of 1 to -1. and write back to the
file again.
sed 's/1/@/g;s/0/+1/g;s/@/-1/g' file > new_file
Hardly a Verilog question though.
 
If you have access to the program sed (within cygwin)

sed -e "s/1/-1/g" -e "s/0/+1/g" < input_file

- Newman

"Sridhar_Gadda" <sridhargadda@yahoo.com> wrote in message
news:0d420176d6b2249a5705656ef88c351d@localhost.talkaboutprogramming.com...
Hello,

I have a textedit file with values 0's and 1's. I want to change
the value of zero to +1 and the value of 1 to -1. and write back to the
file again.

Any help can be appreciated.

Thanks in advance.

Sridhar
 

Welcome to EDABoard.com

Sponsor

Back
Top