Re: sed "Hello, world!" program?
Tim Chase <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <[email protected]> |
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