Sponsored Content
Full Discussion: list last few lines command
Top Forums UNIX for Dummies Questions & Answers list last few lines command Post 54564 by zazzybob on Wednesday 18th of August 2004 08:54:24 AM
Old 08-18-2004
Pipe through "tail"

e.g.

ls -l | tail -5 (or ls -l | tail -n 5)

man tail

Cheers
ZB
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract lines with a given list of identifiers

Hi All, My question is if the simple but powerful shell scripts can extract data from a big data file by using a list of identifier. I used to put everything in the database and do joining, which sounds stupid but only way I knew. For example, my data file looks like, ... (3 Replies)
Discussion started by: mskcc
3 Replies

2. UNIX for Dummies Questions & Answers

[bash]Stripping lines from a list

Hello! I have a script that is (among other things) doing the following: list=/tmp/list1.txt ncftpls -u <user> -p <password> -x "-l1" server.domain.tld > $list cat $list | nl echo "Choose file: " read file cat /tmp/list1.txt | nl | grep $file | sed -e "s/$file//g" -e "s/ //g" | column -t... (8 Replies)
Discussion started by: noratx
8 Replies

3. Shell Programming and Scripting

awk/sed Command : Parse parameter file / send the lines to the ksh export command

Sorry for the duplicate thread this one is similar to the one in https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121 Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
Discussion started by: rajan_san
4 Replies

4. UNIX for Advanced & Expert Users

fast way to retreive a list of lines

hi there, i have to read lines from the file, where the line is just above the pattern am looking for typically this looks like this <time-stamp>|----- <pattern am searching >...... <time-stamp>|..... <some garbage > .... the log file is big wc -l ~/log/ompe.log.20081203... (8 Replies)
Discussion started by: kiranreddy1215
8 Replies

5. UNIX for Dummies Questions & Answers

How to list file names instead of lines when grep a gzcat command?

Hi, I want to list filenames instead of lines when i search in compresed files for a string. #gzcat *.gz | grep -l 12345 gives me: <stdin> Anyone got a solution on this problem? (2 Replies)
Discussion started by: HugoH
2 Replies

6. Shell Programming and Scripting

Removing lines from one list from another list.

Hello, I was wondering if there was an easy way to take lines from a single-column list, and remove them from a second single-column list. For example, I want to remove the contents of list 1 from list 2. How would I do this? Contents of list 1: server1a server2b server3c server4a... (2 Replies)
Discussion started by: LinuxRacr
2 Replies

7. UNIX for Dummies Questions & Answers

Appending lines from an existing list to each line in another existing list

Evening all ! I would like to ask your expertise on how to accomplish the following ; I have 2 lists, and would like each line from list2 to be appended to each line in list1, resulting in list3 ; List1; alpha beta charlie List2; one two three (4 Replies)
Discussion started by: TAPE
4 Replies

8. UNIX for Advanced & Expert Users

Need command for grepping pattern lines with subsequent lines

Hi, I have a requirement like, I have a list of pattens in a file say pattern.txt, PHC111 PHC113 and in another file called master.lst i have entries like, PHC111 a b PHC112 a PHC113 b c PHC114 d e (5 Replies)
Discussion started by: rbalaj16
5 Replies

9. Shell Programming and Scripting

Removing non-unique prefixed lines from a list

Not quite sure how to explain what I need to do (or how to title the post!) so will try and show it! Basically I have a list of 'modules' which takes the form seen below, where there can be a module name, module type and module version (a module may not have each of those and could in theory... (2 Replies)
Discussion started by: chrissycc
2 Replies

10. UNIX for Dummies Questions & Answers

Comparing lines within a word list

Hello all- New to this forum, and relatively new to using grep at the Terminal command line to work with regular expressions. I've got a background in math and some programming experience, so it's not been too difficult to learn the basics of searching through my word lists for particular types of... (13 Replies)
Discussion started by: dtalvacchio
13 Replies
tail(1) 							   User Commands							   tail(1)

NAME
tail - deliver the last part of a file SYNOPSIS
/usr/bin/tail [+-s number [lbcr]] [file] /usr/bin/tail [-lbcr] [file] /usr/bin/tail [+- number [lbcf]] [file] /usr/bin/tail [-lbcf] [file] /usr/xpg4/bin/tail [-f | -r] [-c number | -n number] [file] /usr/xpg4/bin/tail [+- number [l | b | c] [f]] [file] /usr/xpg4/bin/tail [+- number [l] [f | r]] [file] DESCRIPTION
The tail utility copies the named file to the standard output beginning at a designated place. If no file is named, the standard input is used. Copying begins at a point in the file indicated by the -cnumber, -nnumber, or +-number options (if +number is specified, begins at distance number from the beginning; if -number is specified, from the end of the input; if number is NULL, the value 10 is assumed). number is counted in units of lines or byte according to the -c or -n options, or lines, blocks, or bytes, according to the appended option l, b, or c. When no units are specified, counting is by lines. OPTIONS
The following options are supported for both /usr/bin/tail and /usr/xpg4/bin/tail. The -r and -f options are mutually exclusive. If both are specified on the command line, the -f option is ignored. -b Units of blocks. -c Units of bytes. -f Follow. If the input-file is not a pipe, the program does not terminate after the line of the input-file has been copied, but enters an endless loop, wherein it sleeps for a second and then attempts to read and copy further records from the input-file. Thus it can be used to monitor the growth of a file that is being written by some other process. -l Units of lines. -r Reverse. Copies lines from the specified starting point in the file in reverse order. The default for r is to print the entire file in reverse order. /usr/xpg4/bin/tail The following options are supported for /usr/xpg4/bin/tail only: -c number The number option-argument must be a decimal integer whose sign affects the location in the file, measured in bytes, to begin the copying: + Copying starts relative to the beginning of the file. - Copying starts relative to the end of the file. none Copying starts relative to the end of the file. The origin for counting is 1; that is, -c+1 represents the first byte of the file, -c-1 the last. -n number Equivalent to -cnumber, except the starting location in the file is measured in lines instead of bytes. The origin for count- ing is 1. That is, -n+1 represents the first line of the file, -n-1 the last. OPERANDS
The following operand is supported: file A path name of an input file. If no file operands are specified, the standard input is used. USAGE
See largefile(5) for the description of the behavior of tail when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes). EXAMPLES
Example 1 Using the tail Command The following command prints the last ten lines of the file fred, followed by any lines that are appended to fred between the time tail is initiated and killed. example% tail -f fred The next command prints the last 15 bytes of the file fred, followed by any lines that are appended to fred between the time tail is initi- ated and killed: example% tail -15cf fred ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of tail: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, and NLSPATH. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: /usr/bin/tail +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ /usr/xpg4/bin/tail +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWxcu4 | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
cat(1), head(1), more(1), pg(1), dd(1M), attributes(5), environ(5), largefile(5), standards(5) NOTES
Piped tails relative to the end of the file are stored in a buffer, and thus are limited in length. Various kinds of anomalous behavior can happen with character special files. SunOS 5.11 13 Jul 2005 tail(1)
All times are GMT -4. The time now is 11:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy