Count lines and words of a stream output with tail
Hello,
I need to tail -f a file output stream and I need to get only lines that contains "get" and "point" in the same line. It doesn't matter the order.
Then I need only the text BEFORE "point".
I have to count each line and perform other serveral actions after this has performed 3 times.
I have done something like this. But I don't know how to go on.
I am currently learning about AWK. I don't know if there's a straight forward way to do this with AWK. It would be nicer to avoid "grep".
The tail -f output would be something like this:
And after processing it, it should do something to get the lines with "get" and "point". It would see something like this:
Next step is extracting everything before "point":
Count words in each line:
And quit when this is performed 3 times. So it will quit tail -f right now because it has perform it three times.
I am getting very frustrated.. Thanks a lot for any idea you can give..
Hi all,
I've a structure let's say
typdef struct a { int a; int b; char* string} b;
I need to make the function smth like readdir(), returning everytime it's called pointer to the next structure. Let's say functions would read the next file in the directory and all the permitions put it in... (2 Replies)
Hello
I wander if im doing :
ls -l and its giving me lets say 3 results :
-rw-r--r-- 1 blah other 1789 May 19 2003 foo.c
-rw-r--r-- 1 blah other 1014 May 19 2003 foo.h
-rw-r--r-- 1 blah other 270 May 19 2003 foo1.c
now I would like to use the first... (1 Reply)
Hello,
i am trying to write a script file in awk which yields me the number of lines,characters and words, i checked it many many times but i am not able to find any mistake in it. Please tell me where i went wrong.
BEGIN{
print "Filename Lines Words Chars\n"
}
{
filename=filename + 1... (2 Replies)
Please help in the following problem:
Input is:
Pritam
123
456
Patil
myname
youname
Pritam
myproject
thisproject
iclic
Patil
remaining text
some more text
I need the command which will display the no of lines between two words in the whole file.
e.g. Display all the no of lines... (5 Replies)
hello,
i 'd like your help about a bash script which:
1. finds inside the html file (it is attached with my post) the code number of the Latest Stable Kernel,
2.finds the link which leads to the download location of the Latest Stable Kernel version,
(the right link should lead to the file... (3 Replies)
Hi everybody,
i have this biological situation to fix:
> Id.1
ACGTACANNNNNNNNNNNACGTGCNNNNNNNACTGTGGT
>Id.2
ACGGGT
>Id.3
ACGTNNNNNNNNNNNNACTGGGGG
>Id.4
ACGTGCGNNNNNNNNGGTCANNNNNNNNCGTGCAAANNNNN
........
....
These are nucleotidic sequences with some "NNNN..." always of the same... (4 Replies)
Hi,
I have a requirement to to an ldapsearch and remove the shadow attributes in the output file.
What I do is ldapsearch() | operation to remove shadow > FILE
The ldapsearch gives output like this(with same line formation):
objectClass: FSConfig
objectClass: extensibleObject
fsCAIP:... (10 Replies)
Hey everyone!
I have a tab delimited data set which I want to create an output contained the calculation of number of those lines with a certain value in 2nd and 3rd column.
my input file is like this:
ID1 1 10M AAATTTCCGG
ID2 5 4M ACGT
ID3 5 8M ACCTTGGA
ID4 5 ... (7 Replies)
Hi ,
I need to count the number of errors associated with the two words occurring in the file. It's about counting the occurrences of the word "error" for where is the word "index.js". As such the command should look like. Please kindly help. I was trying: grep "error" log.txt | wc -l (1 Reply)
Is there an efficient awk that can count the number of lines that occur in between two tags.
For instance, consider the following text:
<s>
Hi PP -
my VBD -
name DT -
is NN -
. SENT .
</s>
<s>
Her PP -
name VBD -
is DT -
the NN -
same WRT -
. SENT -
</s>
I am interested to know... (4 Replies)
Discussion started by: owwow14
4 Replies
LEARN ABOUT OPENSOLARIS
tail
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)