Should be the simplest thing in the world grep


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Should be the simplest thing in the world grep
# 1  
Old 04-27-2011
Should be the simplest thing in the world grep

should be the simplest thing in the world use grep

but i not get it
i have several files, in this files i need to khow how many times the words are repeated but the files must star whit P_

this work
egrep -c "word1|word2" *P_*

result:
P_11351814:1
P_11351823:3
P_11351826:1
P_11351842:5

but how to add the results? to get 10....
# 2  
Old 04-27-2011
Code:
egrep -c "word1|word2" P_* | awk -F\: '{s+=$2}END{print s}'

# 3  
Old 04-27-2011
WORK!!!!
Smilie

thank you for quick response
Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. What is on Your Mind?

Mad World Remix of Moby Video (Are You Lost In The World Like Me)

This is an excellent video comment on modern society and the remix is good too: https://www.youtube.com/watch?v=5DU1B_XkyIk 5DU1B_XkyIk Watch the video above and post your comments. (3 Replies)
Discussion started by: Neo
3 Replies

2. UNIX for Dummies Questions & Answers

Simplest way to access Linux system mail from email client

I'm not a Linux newbie but this seemed like a pretty n00b question. I am familiar with Postfix/Dovecot setups but now I am looking for the simplest way to access mail on a Linux system, such as the mail that goes to /var/mail/root. I know I can edit /etc/aliases and have the system mail go straight... (6 Replies)
Discussion started by: TayKimchi
6 Replies

3. Programming

The simplest network driver

Hi, I am trying to write the simplest network driver that would send whatever through cable. My configuration is: Linux machine with some Intel network adapter Another machine with WireShark I connected Intel network adapter to second machine and want anything to pop up at wireshark. ... (12 Replies)
Discussion started by: Chrisdot
12 Replies

4. UNIX for Dummies Questions & Answers

Simplest way to format with If on stout?

So I'm trying to figure out a way to do some very simple formatting on standard output. I have a command that I will run (many many times) the output will either be true or false. So all i really want is to run the command and if its true write true in green and if its false to write false in red.... (10 Replies)
Discussion started by: MrEddy
10 Replies

5. Shell Programming and Scripting

Grep related thing

Is there any way i can use grep to do this I have file which is continuously growing,I want grep to star search from say line number 1210 is that possible. (5 Replies)
Discussion started by: aliahsan81
5 Replies

6. UNIX for Dummies Questions & Answers

I'm incapable of the simplest thing

Okay, stupid question How can I use ed, exactly? I need just a quick tutorial, thanks. Cheers! Tavy (2 Replies)
Discussion started by: Tavy
2 Replies

7. UNIX for Dummies Questions & Answers

the simplest question in the WORLD

how do i get unix on my windows 95 computer? (3 Replies)
Discussion started by: killfry
3 Replies
Login or Register to Ask a Question