I have a file called test.txt
I have a pattern file called pattern.txt containing the following
I want to do a count, but have it display the count value preceeding each line like grep -n
so
grep -n -f pattern.txt would show
What I would like to do is have grep count the number of occurances in the file and place that value at the begining of the output so it would look like
3 means abc occured 3 times in the file
2 means def occured 2 times in the file
Is there a function or a clever way to achieve this?
How would I do the following :
Records other than ”ATOM”,”CONNECT”, ”HETATM”, ”TER” and ”END” are considered header records which describe the metadata about the molecule. Use grep to generate the header.
I have this chemistry database. On the attachment. But I am not sure how to use... (4 Replies)
i have this line of code that looks for the same file if it is currently running and returns the count.
`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`
basically it is assigned to a variable
ISRUNNING=`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh |... (6 Replies)
I have a file against which I can grep a string for. I can also check for that string count using wc -l (or grep -c). I need to display the results of both in one output i.e. 'line containing string' and 'count' - what would be the most efficient way of managing this? Thanks in advance. (3 Replies)
/usr/xpg4/bin/grep -e "Type" / datarecords.txt
output
datarecords.txt: male | datarecords.txt: male | datarecords.txt: female
i wanna the output to be
:male | :male | :female
at the end not to appear the filename fom grep command :D :D (3 Replies)
I use grep to check for a string that validates data in a file, it works great but the problem is that the file is becoming too big and gerp has started hurting the response time to users. Since I only need to find the first occurrence I have been looking for ways to stop grep for scanning the rest... (8 Replies)
Hi
is there a way in grep to display few lines before and after the pattern??
I tried options A and B and after-context and before-context. But they don't work on Solaris platform.
please advise. (13 Replies)
Folks, is it possible to display only words with grep (or any built-in ultility)?
I have more than 1 pattern to search, say apple & orange
The text goes like this:
So I need to display all the words starting with apple or orange
The output should be:
Any idea? (7 Replies)
Hi Guru's.... I've one log file in all my systems which writes the backup information..
I'have written a command like this:
ssh -l ora${sid} ${primaryhost} "tail -50 /oracle/$ORACLE_SID/newbackup/END_BACKUP.log" |grep 'insert' |tail -1| awk '{print $7}'
We have nearly 50 systems in our... (2 Replies)
I have the following data:
A
1
2
3
A
4
5
6
A
7
8
9
I want to grep this data with A and 3 lines below it then display them in this format:
A 1 2 3
A 4 5 6
A 7 8 9 (4 Replies)