0

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??

2 Answers2

2

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.
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
0

Solaris 11.2 tail get the last 100 lines from file: tail -100 filename.txt

Solaris 11.2 get very last character with tail: /usr/xpg4/bin/tail -c -2 saida.txt

get 2 last characters with tail: /usr/xpg4/bin/tail -c -3 saida.txt

Eliandro
  • 59
  • 5