Sponsored Content
Top Forums Shell Programming and Scripting Grepping from a point in a file to the end of the file Post 302502946 by vbe on Wednesday 9th of March 2011 09:52:55 AM
Old 03-09-2011
Or using quotes:

Code:
ant:/home/vbe $ more tst00001                     
     1  awk '/2011 John Doe 8344/,0' /tmp/ops.log | egrep -c "received request"
     2  awk '/201 John Doe 8344/,0' /tmp/ops.log | egrep -c "received request"
     3  awk '/211 John Doe 8344/,0' /tmp/ops.log | egrep -c "received request"
     4  awk '/011 John Doe 8344/,0' /tmp/ops.log | egrep -c "received request"
     5  awk '/11 John Doe 8344/,0' /tmp/ops.log | egrep -c "received request"
     6  awk '/2012 John Doe 8344/,0' /tmp/ops.log | egrep -c "received request"
     7  awk '/2013 John Doe 8344/,0' /tmp/ops.log | egrep -c "received request"
     8  awk '/2021 John Doe 8344/,0' /tmp/ops.log | egrep -c "received request"
     9  awk '/2011 John Dee 8344/,0' /tmp/ops.log | egrep -c "received request"
    10  awk '/2011 John Die 8344/,0' /tmp/ops.log | egrep -c "received request"
    11  awk '/2011 John Dae 8344/,0' /tmp/ops.log | egrep -c "received request"
    12  awk '/2011 John Doe 8344/,0' /tmp/ops.log | egrep -c "received request"
ant:/home/vbe $ grep "2011 John Doe 8344" tst00001
     1  awk '/2011 John Doe 8344/,0' /tmp/ops.log | egrep -c "received request"
    12  awk '/2011 John Doe 8344/,0' /tmp/ops.log | egrep -c "received request"

(HPUX11.11...)

Last edited by vbe; 03-09-2011 at 10:56 AM.. Reason: added OSversion...
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to change the file modification time of a file on nfs mount point

Hi I am accessing a file on nfs mounted device, after completing using of the file, i am tring to restore the access time and modification times of the file. So i got the previous modified time of the file using stat() function and trying to set the date and time for the file, To set these... (6 Replies)
Discussion started by: deepthi.s
6 Replies

2. Shell Programming and Scripting

Grepping a file based on input from a second file

how to grep a file based on another input file File1 ashu 1 ninetwo hari qwer 6 givefour jan fghj 8 noeight mar vbmi 7 noput feb -- --- File2 noput noeight --- -- Taking the input of grep as File2, a search need to be made in File1 giving File3 as output: (7 Replies)
Discussion started by: er_ashu
7 Replies

3. UNIX for Dummies Questions & Answers

deleting word from this point to end of file in VI

Hi All i need to delete a recurring word from point "n" till end of the file. there are other words in this file so i cannot use `dG`, can anyone help me out? Kind regards Brian (4 Replies)
Discussion started by: brian112
4 Replies

4. Shell Programming and Scripting

Grepping file and returning passed variable if the value does not exist in file at all.

I have a list of fields that I want to check a file for, returning that field if it not found at all in the file. Is there a way to do a grep -lc and return the passed variable too rather then just the count? I am doing some crappy work-around now but I was not sure how to regrep this for :0 so... (3 Replies)
Discussion started by: personalt
3 Replies

5. Shell Programming and Scripting

deleting the part of the file(overwrite) using start and end point

here is the contents of bigfile.sql CREATE TABLE `Table11` ( `id` int(11) NOT NULL , `entityName` enum('Lines','EndUsers') COLLATE utf8_unicode_ci NOT NULL, `parentAllianceMigrationProjectId` varchar(255) NOT NULL ) ENGINE=InnoDB AUTO_INCREMENT=2000 DEFAULT CHARSET=utf8... (30 Replies)
Discussion started by: vivek d r
30 Replies

6. Shell Programming and Scripting

How to perform a hexdump using dd from start point to end point?

hi, I would like to ask or is it possible to dump a hex using dd from starting point to end point just like the "xxd -s 512 -l 512 <bin file>" I know the redirect hexdump -C but i can't figure it out the combination options of dd. Hope someone can share their knowledge.. Thanks in... (3 Replies)
Discussion started by: jao_madn
3 Replies

7. Shell Programming and Scripting

Display file date after grepping a string in the file

Hi All, I need to recursively grep several folders for a MAC address and display the results with the date of the file name at the start. Even better would be if the final results were displayed chronologically so the newest file is always at the end. Oldest at the top, regardless of what... (8 Replies)
Discussion started by: quemalr
8 Replies

8. Shell Programming and Scripting

Grepping text from one file in another file

Hello, I have a file with a large number of words each listed in sequential order one word per line. I want to search these words in another file which has the structure Both the files are large, but the words in the sourcefile are all available in the target file. I tried to grep... (2 Replies)
Discussion started by: gimley
2 Replies

9. Shell Programming and Scripting

Grepping one file column from another file

Hi all, I want to search the second col of a file as a sub-part of 4th col of another file and produce a joint output. In the example, search if B is contained as a sub-part in E:B:C (sub-parts separated by colons). Note the second row is not found doesnt find a match as F isnt there in col 4... (19 Replies)
Discussion started by: newbie83
19 Replies

10. Shell Programming and Scripting

ksh Script, Reading A File, Grepping A File Contents In Another File

So I'm stumped. First... APOLOGIES... my work is offline in an office that has zero internet connectivity, as required by our client. If need be, I could print out my script attempts and retype them here. But on the off chance... here goes. I have a text file (file_source) of terms, each line... (3 Replies)
Discussion started by: Brusimm
3 Replies
SQLITE_NUM_ROWS(3)														SQLITE_NUM_ROWS(3)

sqlite_num_rows - Returns the number of rows in a buffered result set

SYNOPSIS
int sqlite_num_rows (resource $result) DESCRIPTION
Object oriented style (method): int SQLiteResult::numRows (void ) Returns the number of rows in the buffered $result set. PARAMETERS
o $result - The SQLite result resource. This parameter is not required when using the object-oriented method. Note This function cannot be used with unbuffered result handles. RETURN VALUES
Returns the number of rows, as an integer. EXAMPLES
Example #1 Procedural example <?php $db = sqlite_open('mysqlitedb'); $result = sqlite_query($db, "SELECT * FROM mytable WHERE name='John Doe'"); $rows = sqlite_num_rows($result); echo "Number of rows: $rows"; ?> Example #2 Object-oriented example <?php $db = new SQLiteDatabase('mysqlitedb'); $result = $db->query("SELECT * FROM mytable WHERE name='John Doe'"); $rows = $result->numRows(); echo "Number of rows: $rows"; ?> SEE ALSO
sqlite_changes(3), sqlite_query(3), sqlite_num_fields(3). PHP Documentation Group SQLITE_NUM_ROWS(3)
All times are GMT -4. The time now is 08:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy