Visit Our UNIX and Linux User Community

Word count while excluding

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Word count while excluding
# 1  
Old 10-19-2009
Word count while excluding


Is there a way to word count a file while excluding lines that have FRP in them?

wc -l "filename"?

Thanks in advance

# 2  
Old 10-19-2009

You could use grep, then wc.

grep -v FRP filename | wc -l

# 3  
Old 10-19-2009
grep -vc FRP filename

# 4  
Old 10-19-2009
You're on the money!
# 5  
Old 10-19-2009
Worked great, thnx a lot Smilie

Previous Thread | Next Thread
Test Your Knowledge in Computers #445
Difficulty: Easy
Scientific Linux has been loaded onto systems at the International Space Station.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

UNIX script to check word count of each word in file

I am trying to figure out to find word count of each word from my file sample file hi how are you hi are you ok sample out put hi 1 how 1 are 1 you 1 hi 1 are 1 you 1 ok 1 wc -l filename is not helping , i think we will have to split the lines and count and then print and also... (4 Replies)
Discussion started by: mirwasim
4 Replies

2. Shell Programming and Scripting

Help needed in excluding certain word patterns

Hi, I need help with following. I need to exclude words that match following patterns a. more than length 4 (example SBRAP) b. contains mixture uppercase and lower case regardless of the length (example GSpD) File contains COFpC MCHX SP SNFCA GEH SBRAP DGICA JPMpE WFCpP GSpD AXL... (5 Replies)
Discussion started by: jakSun8
5 Replies

3. Shell Programming and Scripting

Help needed in excluding word

Hello, When i run this command find ./ -type f -print | xargs grep -l 'myWord' it prints the file name where 'myWord' exists and also something like the below which i want to exclude grep: can't open Fields grep: can't open Search I tried piping and grep -v 'open' but it did not work. ... (3 Replies)
Discussion started by: jakSun8
3 Replies

4. Shell Programming and Scripting

extracting part of a line excluding particular word from it

here is the line on which i want to process `empNo` int(13) NOT NULL AUTO_INCREMENT, it sometimes doesnt have comma at the end too `empNo` int(13) NOT NULL AUTO_INCREMENT i want to extract all except "AUTO_INCREMENT" not only this line i ,want the code to work on any line if it has... (5 Replies)
Discussion started by: vivek d r
5 Replies

5. UNIX for Dummies Questions & Answers

How to get complete path in variable excluding last word?

Hello Experts, Can you please help me by providing a code which can give me the complete path except last word in a variable, the variable i can use anywhere else for my operation eg: if this below one is my path: ... (3 Replies)
Discussion started by: aks_1902
3 Replies

6. Shell Programming and Scripting

if, word count

Hi, I need to count the lines of a file stack.html and if the amount lines i want to do something. At this moment, I have if ; then ... This is not working. Any ideas? Thanks! (3 Replies)
Discussion started by: azertyazerty
3 Replies

7. UNIX for Dummies Questions & Answers

Count number of files in directory excluding existing files

Hi, Please let me know how to find out number of files in a directory excluding existing files..The existing file format will be unknown..each time.. Thanks (3 Replies)
Discussion started by: ammu
3 Replies

8. Shell Programming and Scripting

how to find the count of commas in a string excluding the ones in double quotes

Hi, my requirement is to find the count of commas in a string excluding the ones in double quotes. For example: If the input string is abc,,lmhgdf,"abc, 401 street","tty,stt",45,23,45 The output should be 7 (7 Replies)
Discussion started by: amitshete
7 Replies

9. Shell Programming and Scripting

Word count of lines ending with certain word

Hi all, I am trying to write a command that can help me count the number of lines in the /etc/passwd file ending in bash. I have read through other threads but am yet to find one indicating how to locate a specifc word at the end of a line. I know i will need to use the wc command but when i... (8 Replies)
Discussion started by: warlock129
8 Replies

10. Shell Programming and Scripting

specified word count

hi iam trying to do a specified word count on file called text i have a few ideas but don't get the result i want do any one have a idea please help i have this at the moment cat text echo "Please enter the word you are looking for:" read string echo "the word < $string > occurs in... (5 Replies)
Discussion started by: bhaviknp
5 Replies

Featured Tech Videos