02-25-2009
count and content in the same command
Hi,
I have small query and a understanding, could you please clarify the query and correct my understanding..?
I am very big log file If i need to take a count and contained lines for a particular pattern/word i am using the grep command twice like the below.
grep -c "OutOfMemoryException" sample.log
grep "OutOfMemoryException" > tmp.txt
This way i think i am using wrong logic i think i can use awk command like
awk '/OutOfMemoryException/' sample.log '{print $0, $NR}'
Please correct me if i am wrong.
Thanks
Senthilkumar
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi
I run on a Unix webserver at my university. I have a couple of *.inc files which are include files used for php.
They are all in one folder without an index file. If you go to the folder, you get to see a list of files in that dir.
Some of the .inc have a question mark icon next to... (3 Replies)
Discussion started by: aqh2
3 Replies
2. UNIX for Dummies Questions & Answers
Hey guys,
I'd like to delete all text within a text file without actually deleting the file. Is there a vi command I can do from my prompt without actually going into the file and doing a %d i think it is... to remove all the text inside?
I want to add this to a cron job to erase all the data... (2 Replies)
Discussion started by: kingdbag
2 Replies
3. Linux
Hello all;
I've been having trouble completing a script (bash) because I can't get past the issue of finding a line in a file. For example, I have a file like this:
ddmmmyyyy Lon Lat
24may2003 -100.0 24.1
25may2003 -100.1 24.0
28may2003 -99.5 23.2
....etc... (4 Replies)
Discussion started by: lunchtime
4 Replies
4. UNIX for Dummies Questions & Answers
Hi All,
I'm trying to count how many line in my *.txt file.
My *.txt file has 1937 lines.
The problem is : when I use wc -l command
the result is 1936.
Again, I did some test. I create a new file with 100 lines with text editor (Notepad ++, Ultra edit).
And when I count it again with wc... (2 Replies)
Discussion started by: kunimi
2 Replies
5. UNIX for Dummies Questions & Answers
hi every one..
i am new to working in unix environment..
i have a problem in transferring files using scp command..
i am transferring files using scp command on one unix manchine to another unix machine..
the syntax is scp -r sourcedirectory destination directory
The files in sourcedirectory... (1 Reply)
Discussion started by: GovindGembali
1 Replies
6. Shell Programming and Scripting
hi buddies;
ip.txt:
192.168.1.1
192.168.1.2
192.168.1.3
192.168.1.4
192.168.1.5
...
parameters.txt:
portvalue
username
password
session
... (2 Replies)
Discussion started by: gc_sw
2 Replies
7. Shell Programming and Scripting
$ cat File1
Non HTTP response code:java.net.ConnectException225073X
000000005143329Load time: 402335410224
Non HTTP response code: ava.net.ConnectException206423X
000000005143330Load time: 402305687161
Non HTTP response code: ava.net.ConnectException290212X
000000005143331Load time:... (1 Reply)
Discussion started by: ooilinlove
1 Replies
8. UNIX for Dummies Questions & Answers
Hi everyone,
I have UNIX this semester and I am just getting started with the commands. An interesting question came up while discussing the head and tail commands.
Suppose that I have text file with the following data in the following format-:
NAME ROLL MARKS
Sam 05 ... (2 Replies)
Discussion started by: sreyan32
2 Replies
9. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
You are given a ANSI text file (a.txt) in the following format and with the following contents-:
NAME ROLL... (7 Replies)
Discussion started by: sreyan32
7 Replies
10. Shell Programming and Scripting
Hi Everyone,
I'm new to unix scripting. Hoping you guys can help me out. I am trying to create a script that will do a count command for each file (in this example *.dat) within a predefined directory and display only the filename without the full path.
This is what I got so far, but it... (10 Replies)
Discussion started by: kadawtomtom978
10 Replies
YAZ_HITS(3) 1 YAZ_HITS(3)
yaz_hits - Returns number of hits for last search
SYNOPSIS
int yaz_hits (resource $id, [array &$searchresult])
DESCRIPTION
yaz_hits(3) returns the number of hits for the last search.
PARAMETERS
o $id
- The connection resource returned by yaz_connect(3).
o $searchresult
- Result array for detailed search result information.
RETURN VALUES
Returns the number of hits for the last search or 0 if no search was performed.
The search result array (if supplied) holds information that is returned by a Z39.50 server in the SearchResult-1 format part of a search
response. The SearchResult-1 format can be used to obtain information about hit counts for various parts of the query (subquery). In par-
ticular, it is possible to obtain hit counts for the individual search terms in a query. Information for first subquery is in $array[0],
second subquery in $array[1], and so forth.
searchresult members
+--------------------+---------------------------------------+
| Element | |
| | |
| | Description |
| | |
+--------------------+---------------------------------------+
| | |
| id | |
| | |
| | Sub query ID2 (string) |
| | |
| | |
| count | |
| | |
| | Result count / hits (integer) |
| | |
| | |
| subquery.term | |
| | |
| | Sub query term (string) |
| | |
| | |
|interpretation.term | |
| | |
| | Interpretated sub query term (string) |
| | |
| | |
|recommendation.term | |
| | |
| | Recommended sub query term (string) |
| | |
+--------------------+---------------------------------------+
Note
The SearchResult facility requires PECL YAZ 1.0.5 or later and YAZ 2.1.9 or later.
Note
Very few Z39.50 implementations support the SearchResult facility.
PHP Documentation Group YAZ_HITS(3)