Sponsored Content
Full Discussion: Break out of tail -f
Top Forums Shell Programming and Scripting Break out of tail -f Post 302778847 by DGPickett on Monday 11th of March 2013 04:12:53 PM
Old 03-11-2013
Well, tail -f can be a problem to manage, but the file is the file. Data can get hung up in the pipe, too. Shell can find strings without calling grep, using case. Logs can be written in blocks from a FILE* buffer. You could poll and just tail a big hunk of file. You could figure how many lines you have checked and just check up-file of there. Really economical and efficient solutions would be in C, where you can mmap() the file as it growns and monitor the content with low overhead just in areas not already checked.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

using tail -f

Working in HP-UX 10.20. I eventually want to write a bourne shell script to handle the following problem, but for now I am just toying with it at the command line. Here's what I am basically trying to do: tail -f log_X | grep n > log_Y I am doing a tail -f on log_X . Once it sees "n", I... (6 Replies)
Discussion started by: cdunavent
6 Replies

2. Shell Programming and Scripting

Tail??

Hello all, I have search the forum and could not find an answer...Here is what I am trying to do. Every 15 minutes, a script send uptime output to a logfile (dailylog.log), that file contains lines like the one below: 11:21am up 44 days, 19:15, 1 user, load average: 0.00, 0.02, 0.03 ... (7 Replies)
Discussion started by: qfwfq
7 Replies

3. Shell Programming and Scripting

tail -f

I am trying to extract a particular line from a.log which keeps appending every sec and output that into a newfile b.log which should append itself with filtered data received from a.log I tried tail -f a.log |grep fail| tee -a b.log nothing in b.log tail -f a.log |grep fail >>b.log ... (4 Replies)
Discussion started by: wannalearn
4 Replies

4. HP-UX

Break mirror so that it can be used later

Hello again, We need to install patches to HP-UX B.11.11 but would like to break the mirror it has (with out damaging it) so that in case of failure we can use this a meassure procedure. Any ideas on how to do this Thank you! (2 Replies)
Discussion started by: AQG
2 Replies

5. Shell Programming and Scripting

break out of 'if'

is it possible? because i still need to keep on reading even though i don't want to read that particular line (7 Replies)
Discussion started by: finalight
7 Replies

6. Shell Programming and Scripting

help on page break

Hi, i have a file say samp.s which has 123 a b c d 123 e f g h 123 i j k l 123 m n o p 234 a b c d 234 e f g h 234 i j k l the first 3 characters in each line are considered the key values i have one more file temp.txt which has 123 234 i want to have a page break in... (5 Replies)
Discussion started by: Sheema
5 Replies

7. Shell Programming and Scripting

break: cannot break

hi guys I am working on a menu for linux... some basic stuff. but I have an issue. I got 1 server where something is working and the same thing does not work in the same way in another linux box Basically I am simulating a command line where user insert some commands and to end and go back... (7 Replies)
Discussion started by: karlochacon
7 Replies

8. Shell Programming and Scripting

BASH: Break line, read, break again, read again...

...when the lines use both a colon and commas to separate the parts you want read as information. The first version of this script used cut and other non-Bash-builtins, frequently, which made it nice and zippy with little more than average processor load in GNOME Terminal but, predictably, slow... (2 Replies)
Discussion started by: SilversleevesX
2 Replies

9. Shell Programming and Scripting

Joining multiple files tail on tail

I have 250 files that have 16 columns each - all numbered as follows stat.1000, stat.1001, stat.1002, stat.1003....stat.1250. I would like to join all 250 of them together tail by tail as follows. For example stat.1000 a b c d e f stat.1001 g h i j k l So that my output... (2 Replies)
Discussion started by: kayak
2 Replies

10. Shell Programming and Scripting

Tail +

because the tail +2 on the first line gives me the file name pomga I do not want anything like what I miss tail +2 ejemplo.txt ouput ==> ejemplo.txt <== 1 2 3 4 5 6 7 8 9 10 (2 Replies)
Discussion started by: tricampeon81
2 Replies
tail(1) 						      General Commands Manual							   tail(1)

NAME
tail - Writes a file to standard output, beginning at a specified point SYNOPSIS
tail [-f | -r] [-c number | -n number] [file] tail [+number | -number] [unit] [-f | -r] [file] The tail command writes the named file (standard input by default) to standard output, beginning at a point you specify. The second synopsis form of this command is obsolete, and support may be withdrawn at any time. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: tail: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Displays the remainder of the file from the starting point number where number is measured in bytes. The sign of number affects the loca- tion in the file at which to begin the copying: Copying begins relative to the beginning of the file. Copying begins relative to the end of the file. Copying begins 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. Does not end after it copies the last line of the input file if the input file is not read from a pipe, but enters an endless loop in which it sleeps for a sec- ond 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 being written by another process. Has no effect if specified with -r. Displays remainder of file from the starting point number where number is measured in lines. The sign of number affects the location in the file, measured in lines, to begin the copying: Copying begins relative to the beginning of the file. Copying begins relative to the end of the file. Copying begins relative to the end of the file. The origin for counting is 1, that is, -n +1 represents the first line of the file, -n -1 the last. [Tru64 UNIX] Causes tail to print lines from the end of the file in reverse order. The default for -r is to print the entire file this way. Overrides -f. Begins reading number lines (l), 512-byte blocks (b), kilobyte blocks (k), characters (c and m) from the end of the input. The m argument counts mulktibyte characters as single-byte characters, while c counts characters byte-by-byte but does not break mulk- tibyte characters. The default unit is l for lines. The default number is 10 for all units. Begins reading number lines (l), 512-byte blocks (b), 1-kilobyte blocks (k), or characters (c and m) from the beginning of the input. The m argument counts mulktibyte characters as sin- gle-byte characters, while c counts characters byte-by-byte but does not break mulktibyte characters. The default unit is l for lines. The default number is 10 for all units. In the non-obsolescent form, if you do not specify either -c or n, -n 10 is the default. DESCRIPTION
If you do not specify -f, -r, -number, or +number, tail begins reading 10 lines before the end of the file. The default starting point is - (end of input), l (lines) is the default unit, and 10 is the default number. By specifying +, you can direct tail to read from the beginning of the file. By specifying a number or a unit, or both, you can change the point at which tail begins reading. [Tru64 UNIX] The unit argument can specify lines, blocks, or characters. The tail command can begin reading number (10 by default) units from either the end or the beginning of the file. [Tru64 UNIX] The block size is either 512 bytes or 1 kilobyte. NOTES
When the input is a text file containing mulktibyte characters, use the -c option cautiously since the output produced may not start on a character boundary. EXIT STATUS
The following exit values are returned: Successful completion. An error occurred. EXAMPLES
To display the last 10 lines of a file named notes, enter: tail notes To specify how far from the end to start, enter: tail -20 notes This displays the last 20 lines of notes. To specify how far from the beginning to start, enter: tail +200c notes | more This displays notes a page at a time, starting with the 200th character from the beginning. To follow the growth of a file named accounts, enter: tail -1 -f accounts This displays the last line of accounts. Once every second, tail displays any lines that have been added to the file. This contin- ues until stopped by pressing the Interrupt key sequence. ENVIRONMENT VARIABLES
The following environment variables affect the execution of tail: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to mulktibyte characters in arguments and input files). Determines the locale for the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: cat(1), head(1), more(1), page(1), pg(1) Standards: standards(5) tail(1)
All times are GMT -4. The time now is 02:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy