RE: sed "Hello, world!" program?

Rakesh Sharma <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
the \x21 wont pass muster in most unixes. so cant use that at all.


To: [email protected]
CC: [email protected]
From: [email protected]
Date: Sat, 22 Feb 2014 06:27:03 -0600
Subject: Re: sed "Hello, world!" program?














 

 



  


    
      
      
      On 2014-02-21 22:52, Rakesh Sharma wrote:

> My suggestion is the following:

>     %     yes   |   sed -e 's/.*/Hello, world\!/' -e 'q'

> 

> This takes makes it shell-agnostic



Again, command.com/cmd.exe doesn't have "yes" so I still prefer "echo"

which is available in every shell I have at my disposal (all *nix

shells, command.com, cmd.exe, and Power Shell).  But the

shell-escaping is another layer of complexity.  Using cmd.exe and

command.com expects double-quotes rather than single quotes (though

certain versions of sed might be smart enough to reparse the

arguments for single-quote escaping), so one might have to do use

single-quotes and then tell sed to use an escape sequence.



sed -e "s/.*/Hello, world\x21/" -e q



-tkc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.