Problem with Tail command --urgent pls


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem with Tail command --urgent pls
# 1  
Old 09-21-2006
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.
# 2  
Old 09-21-2006
tail -n 1918 filename > test
# 3  
Old 09-21-2006
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.
Code:
tail -n +1 filename.txt

But in that case, you might as well
Code:
cat filename.txt > filename2.txt

...which is a UUoC. Why not do a simple copy?
Code:
cp filename.txt filename2.txt

# 4  
Old 09-21-2006
hey... I just answered his q for tail... I don't understand it either myself.
# 5  
Old 09-21-2006
Using sed, to copy last 50 lines of file1 in file2 :
Code:
sed -n '50,$p' file1 > file2

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

jean-Pierre.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help Me Pls Its Urgent!!!!!!!!!!!!!!!!

Hi, These are the text file I have //input1.txt// cd dir1/dir2/pg1.txt cd dir3/dir4/pg2.txt cd dir88/dir5/pg4.txt cd dir7/dir6/pg5.txt cd dir8/dir9/pg7.txt And each text file has some text. Now I have to write a shell script which reads input1.txt and changes the directory as shown... (1 Reply)
Discussion started by: bhavanabahety
1 Replies

2. Shell Programming and Scripting

URGENT HELP: problem with mv command

I was trying to move a file to a particular directory. In a hurry i forgot to give the dest directory, as below mv prod.log The file disappeared. :confused: Any idea where it might have moved??? And I have tried moving files based on date from one directory to another as below.... (1 Reply)
Discussion started by: siteregsam
1 Replies

3. Shell Programming and Scripting

pls help me very urgent

will post again (1 Reply)
Discussion started by: revertback
1 Replies

4. Shell Programming and Scripting

Pls Help me.. soon. Very urgent

I have downloaded the Putty SSH configuration. I have entered my Host name as illinois.engr.sjsu.edu and i am trying to save that. But i am unable to save. Also i opened the session and entered my log in name But it says using keyboard interactive authentication.I am not able to get into $ ... (2 Replies)
Discussion started by: VamsiVasili
2 Replies

5. UNIX for Dummies Questions & Answers

URGENT :pls help

Following is d code snipet #!/bin/ksh retVal=`sqlplus -s user/passwd\@oracle_sid <<EOF SET SERVEROUTPUT ON SIZE 100000 DECLARE STATUS_VALUE VARCHAR2(1); BEGIN SELECT temp1 INTO STATUS_VALUE FROM sai; DBMS_OUTPUT.PUT_LINE(STATUS_VALUE); END; / exit; EOF` echo "Return Value... (2 Replies)
Discussion started by: sainathdeg
2 Replies

6. Shell Programming and Scripting

If not working...pls help:URGENT

Following is d code snipet #!/bin/ksh retVal=`sqlplus -s user/passwd\@oracle_sid <<EOF SET SERVEROUTPUT ON SIZE 100000 DECLARE STATUS_VALUE VARCHAR2(1); BEGIN SELECT temp1 INTO STATUS_VALUE FROM sai; DBMS_OUTPUT.PUT_LINE(STATUS_VALUE); END; / exit; EOF` echo "Return Value... (4 Replies)
Discussion started by: sainathdeg
4 Replies

7. Shell Programming and Scripting

Pls Help.. Really Urgent

Hi, I am creating a pipe in a directory $HOME/pipes. The pipename should be L${PROGNAME}. Whenever i embed these lines in shell script, i get an error mkfifo: No such file or directory. I am creating a pipe with the key word mkfifo $HOME/pipes/L${PROGNAME}. Please help me how to get... (5 Replies)
Discussion started by: raghavan.aero
5 Replies

8. UNIX for Dummies Questions & Answers

Crontab - URGENT pls

I put 30 2 * * * /usr/bin/tar cvf /dev/rct0 /u/csa/* in my crontab file (SCO5) but I want to be absolutely sure that the backup job finishes successfully. I know that whenever cron cannot execute a command sends an e-mail to root with the error code and/or an explanation of the problem. ... (6 Replies)
Discussion started by: pappous
6 Replies
Login or Register to Ask a Question