The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
urgent: problem with find command Terrible UNIX for Advanced & Expert Users 10 06-08-2006 02:11 AM
tail command.. amon Shell Programming and Scripting 2 06-02-2006 04:36 AM
PRoblem with tail jhansrod Shell Programming and Scripting 2 06-14-2005 10:17 AM
tail command whatisthis Shell Programming and Scripting 3 03-31-2005 09:34 AM
tail command in SUN & HP_unix clemeot UNIX for Dummies Questions & Answers 3 05-08-2002 11:31 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-21-2006
subbukns subbukns is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 5
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 (permalink)  
Old 09-21-2006
sil sil is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 5
tail -n 1918 filename > test
  #3 (permalink)  
Old 09-21-2006
Glenn Arndt's Avatar
Glenn Arndt Glenn Arndt is offline Forum Advisor  
Anomalous Lurker
  
 

Join Date: Feb 2006
Location: Indianapolis, IN
Posts: 255
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 (permalink)  
Old 09-21-2006
sil sil is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 5
hey... I just answered his q for tail... I don't understand it either myself.
  #5 (permalink)  
Old 09-21-2006
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,418
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 .

jean-Pierre.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:53 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0