1753808 Members
7553 Online
108805 Solutions
New Discussion юеВ

Re: sed command

 
SOLVED
Go to solution
Erol KAHRAMAN
Advisor

sed command

It is a simple question but i can not find the answer :(

i need to split 45% in 45 and % with sed command. i am trying;
$ cat t.txt
45%

$ sed 's/(\d)\%/1/' t.txt
$ sed -e 's/(\d)\%/1/' t.txt

$ sed 's/(.*)\%/1/' t.txt
$ sed -e 's/(.*)\%/1/' t.txt

what is wrong with my reg-exp definition ?
3 REPLIES 3
Dennis Handly
Acclaimed Contributor
Solution

Re: sed command

You are using some foreign devil reg-exp??

$ sed 's/\([0-9]\)%/\1 %/g' t.txt
AwadheshPandey
Honored Contributor

Re: sed command

sed 's/\%/\ %/g' t.txt > newt.txt
It's kind of fun to do the impossible
Erol KAHRAMAN
Advisor

Re: sed command

thx for answers