Problem with Tail command --urgent pls

eg: If I execute an example tail statement to put rows from one file to another, it truncates some of the data.

/carrier>wc -l IntIndA.txt
1918 IntIndA.txt
/carrier>tail -1918 IntIndA.txt > test
/carrier>wc -l test
132 test

The tail command should copy 1918 rows to test file instead of 132 rows.
Could anybody please suggest me why this tail command in our unix box (HP-UX)behaves differently.

tail -n 1918 filename > test

From the man page: "Tails relative to end-of-file are stored in a 20-Kbyte buffer, and thus are limited in length." That might be why. Try tailing from the beginning of the file, not the end, e.g.

tail -n +1 filename.txt

But in that case, you might as well

cat filename.txt > filename2.txt

...which is a UUoC. Why not do a simple copy?

cp filename.txt filename2.txt

hey... I just answered his q for tail... I don't understand it either myself.

Using sed, to copy last 50 lines of file1 in file2 :

sed -n '50,$p' file1 > file2

I think than the value for the tail command is just a bad example :wink: .

jean-Pierre.