Solaris等效于拖尾文件中的字符数

时间:2017-08-06 23:21:48

标签: linux count solaris tail

我正在寻找下面命令的等效命令,该命令适用于AIX和Linux机器,但不适用于Sun Solaris机器。基本上它是拖尾文件并只获取文件的最后10个字符:

tail -c -10 filename.txt

任何想法??

2 个答案:

答案 0 :(得分:2)

根据tail manual page xpg4 变体将执行以下操作:

   /usr/xpg4/bin/tail
       -c number      The number option-argument must  be  a  decimal  integer
              whose sign affects the location in the file, measured in
              bytes, to begin the copying:

              +      Copying starts relative to the beginning  of  the
                     file.
              -      Copying starts relative to the end of the file.
              none   Copying starts relative to the end of the file.

              The  origin for counting is 1; that is, -c +1 represents
              the first byte of the file, -c -1 the last.

答案 1 :(得分:0)

Solaris 11.2 tail从文件中获取最后100行: 尾部-100 filename.txt

Solaris 11.2的最后一个字符带有尾部: / usr / xpg4 / bin / tail -c -2 saida.txt

获取2个带尾的最后一个字符: / usr / xpg4 / bin / tail -c -3 saida.txt