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!
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:
for file in *; do
tail -1 $file
done