Re: sed "Hello, world!" program?

Tim Chase <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
On 2014-02-24 00:41, [email protected] wrote:
> s/.*/Hello, world!/
> q
> 
> Testing the suggested command line syntax on win7 and win8
> environment using cmd.exe leads to an ..."unterminated 's' command"
> caused by a space at RRE and missing doublequotes. Based on the
> suggested syntax this is the one working for me: sed "s/.*/Hello,
> world!/;q"
> 
> Or without quoting (removing spaces): sed s/.*/Hello,World!/;q

Are you trying to put them on the command-line, or are you putting
those two lines in a file and then invoking sed on it (the method
discussed in this sub-thread)?

  c:\temp> copy con hello.sed
  s/.*/Hello, world!/
  q
  ^Z

  c:\temp> sed -f hello.sed < somefile_with_at_least_one_line.txt
  Hello, world!

  c:\temp>

-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.