The UNIX and Linux Forums  


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
tail command and timestamp Begins Shell Programming and Scripting 6 04-16-2008 03:17 AM
Problem with Tail command --urgent pls subbukns Shell Programming and Scripting 4 09-21-2006 12:29 PM
tail command.. amon Shell Programming and Scripting 2 06-02-2006 05:36 AM
help with !(tail -2) command.. using pipes sdlayeeq UNIX for Advanced & Expert Users 8 02-17-2005 03:46 AM
tail command in SUN & HP_unix clemeot UNIX for Dummies Questions & Answers 3 05-08-2002 12:31 PM

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 03-30-2005
whatisthis's Avatar
whatisthis whatisthis is offline
Registered User
  
 

Join Date: Aug 2004
Posts: 175
Arrow tail command

Hi ,
I have found a interesting thing about tail command:
when I tried to use 'tail -1 *' to look at every file with the current derectory, I only got one line of result of one file.
But if I use 'head -1 *', I would get multiple lines.

Is there a way to do get multiple lines with 'tail -1 *' command?

Thanks a lot!
  #2 (permalink)  
Old 03-30-2005
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
Well, if you check the man pages for head and tail, you will find why this is so:

man head:
head [-c|-l] [-n count] [file ...]

man tail:
tail [-f] [-b number] [file]

The ... in the head manpage shows that head can take multiple filenames in input, while tail cannot.

You can check tail of all files in a directory as follows:


Code:
for file in *; do
tail -1 $file
done

  #3 (permalink)  
Old 03-31-2005
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,409
Or download GNU tail...
Quote:
NAME
tail - output the last part of files

SYNOPSIS
tail [OPTION]... [FILE]...

DESCRIPTION
Print the last 10 lines of each FILE to standard output. With more
than one FILE, precede each with a header giving the file name.
  #4 (permalink)  
Old 03-31-2005
whatisthis's Avatar
whatisthis whatisthis is offline
Registered User
  
 

Join Date: Aug 2004
Posts: 175
Lightbulb download GNU tail

Where can I download it?
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 01:21 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