[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tail +N vs. tail -n N
From: |
Paul Eggert |
Subject: |
Re: tail +N vs. tail -n N |
Date: |
Tue, 05 Jul 2005 16:40:32 -0700 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
Greg Jednaszewski <address@hidden> writes:
> tail: `+5' option is obsolete; use `-n 5' since this will be removed in
> the future
This message is no longer present in coreutils CVS. Now, "tail"
silently uses either the old meaning of +5 (as an option) or the new
meaning (as a file name), depending on whether you're in backward
compatibility mode. So the issue of the incorrect diagnostic is moot.
> Second, there does not seem to be an equivalent option for tail +N.
Actually there is. You can use, for example, "tail -n +12".
> http://linux.org.mt/article/selfextract
Ramon, can you please change all instances of "tail +" to "tail -n +"
in that URL? "tail +" is not portable to POSIX 1003.1-2001 hosts, and
some GNU/Linux installations work that way these days. Here is a
patch. (Admittedly "tail -n +12" will not work on old-fashioned
implementations like Solaris; if that's a concern to you, I can send a
more-complicated patch.)
--- selfextract.old 2005-07-05 16:20:33.000000000 -0700
+++ selfextract 2005-07-05 16:21:34.000000000 -0700
@@ -62,7 +62,7 @@ echo ""
# take the archive portion of this file and pipe it to tar
# the NUMERIC parameter in this command should be one more
# than the number of lines in this header file
-<b>tail +12 $0</b> | <b>tar xz</b>
+<b>tail -n +12 $0</b> | <b>tar xz</b>
exit 0
</pre>
@@ -103,7 +103,7 @@ echo ""
<b>SKIP=`awk '/^__ARCHIVE_FOLLOWS__/ { print NR + 1; exit 0; }'
$0`</b>
# take the archive portion of this file and pipe it to tar
-tail <b>+$SKIP</b> $0 | tar xz
+tail -n <b>+$SKIP</b> $0 | tar xz
exit 0
@@ -143,7 +143,7 @@ echo ""
SKIP=`awk '/^__ARCHIVE_FOLLOWS__/ { print NR + 1; exit 0; }' $0`
# Take the TGZ portion of this file and pipe it to tar.
-tail +$SKIP $0 | tar xz <b>-C $WRKDIR</b>
+tail -n +$SKIP $0 | tar xz <b>-C $WRKDIR</b>
# execute the installation script
<b>
@@ -176,7 +176,7 @@ Some *nix systems might not have the GNU
and <tt>gzip</tt> commands to be separated. In this case, the command to
decompress
and extract the archive could be done as follows:
</p>
-<pre>tail +$SKIP $0 <b>| gzip -dc</b> | tar x -</pre>
+<pre>tail -n +$SKIP $0 <b>| gzip -dc</b> | tar x -</pre>
<hr noshade="1" size="1" color="black" />
<p>
The self-installing archive removes the contents of the temporary directory