develooper Front page | perl.beginners | Postings from April 2002

unix -sed

From:
Murzc
Date:
April 28, 2002 08:41
Subject:
unix -sed
Message ID:
b4.ab76a01.29fd721b@aol.com
I have a file with phone numbers, one after another.
I want to output this file to a sed command, that will check if there is 7 
digits, and if there is, then add
3 leading question marks.  This is structured that I need to use sed, not 
PERL or vi.

In vi I could say  :1,$g/^.......$/s/\(.*\)/???\1/g            # and it 
works.
 In Unix when I output to sed         file | sed 's\(.*\)/???\1/g'       ## 
it works.
When I do    file | sed 'g/^.......$/s/\(.*\)/???\1/g'    
I get a message  sed: command garbled:  'g/^.......$/s/\(.*\)/???\1/g' .

What is wrong? Isn't any command from vi able to be done in sed, just take 
out the leading :1,$ ?

Any help appreciated.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About