Search code examples
linuxcountsolaristail

Solaris equivalent for tailing the amount of characters on a file


I am looking for the equivalent for the command below which works on AIX and Linux machines but not on Sun Solaris machines. Basically it is tailing the file and getting only the last 10 characters of the file:

tail -c -10 filename.txt

Any ideas??


Solution

  • According to the tail manual page, the xpg4 variant will do what was asked:

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