Note that there are some explanatory texts on larger screens.

plurals
  1. POsed command difference in behaviour between each OS and its implication
    primarykey
    data
    text
    <p>I have come across a strange but valid difference between the working behavior of <code>sed</code> command. To be frank this has come as a very big surprise to me. </p> <p>Now let us look at the man pages of <code>sed</code> of SUSE Linux and HP (IA64). </p> <hr> <p><strong>SUSE Linux:</strong> </p> <blockquote> <p>DESCRIPTION Sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). While in some ways similar to an editor which permits scripted edits (such as ed), sed works by making only one pass over the input(s), and is consequently more efficient. But it is sed's ability to filter text in a pipeline which particularly distinguishes it from other types of editors. </p> </blockquote> <hr> <p><strong>HP IA64 :</strong> </p> <blockquote> <p>DESCRIPTION sed copies the named text files (standard input default) to the standard output, edited according to a script containing up to 100 commands. Only complete input lines are processed. <strong>Any input text at the end of a file that is not terminated by a new-line character is ignored</strong> </p> </blockquote> <p>The highlighted text, seems to be a major difference in working behavior. So all my scripts started failing in the HP-UX IA64 machine during porting. </p> <p>Question :<br> a. Isn't there any underlying standard that force each vendor to have basic conformity with the implementation? </p> <p>b. In case there are some commands which confirm and others which cannot confirm, can anyone post the list that adhere to standards. </p> <p>c. Now I have a lot of such command that are used as part of my project scripting. What is the best way to check/avoid such kind of error - apart from testing each and every command for all scenario? </p> <p>Basically In such scenario I would be facing problem confirming software <em>working for all scenarios</em> across vendor platforms.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COthat limit of 100 commands to a script seems rather abritrary too! I've mostly worked in a Solaris environment (and some AIX), which are limited compared to the GNU tools of Linux, but as I used to read the news groups, it seemed like HP unix always had more *opportunities* for recoding than anything else. Do you know about POSIX definitions for Unix tools? Doesn't mean that HP has to follow them. Add a Posix tag and maybe a real Posix guru will have some real answers for you. Good luck.
      singulars
    2. COThe underlying standard says that lines in text files shall end with newlines; anything that doesn't meet that leads to undefined behaviour. Don't use `sed` on files that don't end with a newline; it is not portable - as you've just found out the hard way!
      singulars
    3. COThe variation between different versions of `sed` are legion. This is one of the things which makes it hard to write a portable shell script. A practical workaround might be to convert your `sed` scripts to Perl; the Perl distribution comes with a utility `s2p` which does this automatically. Of course, Perl is not even formally specified, but it is portable due to there being only a single implementation. (You might still end up with corner cases where different versions behave differently, but probably not in scripts generated by `s2p`.)
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload