Ubuntu :: Getting Grep To Pull Info From A Specific File Which Match All The Words?

Jun 2, 2011

I am trying to use grep to only tell me files that include both words matching in a pattern file. However when i specify:

grep -f <pattern file> <file>

It pulls out anything that matches one or the other.

Not both.

how to get it to match AND not OR.

View 9 Replies


ADVERTISEMENT

General :: How To Make Grep To Search A Pattern In Only Specific File Type?

Mar 6, 2010

To search a string pattern in all files in a directory and subdirectories, I am using;

Code:
grep -R "myclass::my-func(" mydirectory/
Now I want grep, to search in only specific file types say *.cc. Please help me. I have read manual of grep, but could not deduce any hint.
Best Regards.

View 7 Replies View Related

Programming :: Grep And Pull The IP Based On The Request String?

May 5, 2010

in the access logs i have this:

Code:
IP.IP.IP.IP - - [01/May/2010:11:21:10 -0400] "BIG STRING" 414 250
how can i grep and pull the IP based on the request string?

View 7 Replies View Related

General :: Sed Regex To Match Words Via A Pattern

Oct 24, 2010

I have some lines of text and I want to detect words that meet some criteria with sed.

E.g. The line "tetris cat dog test cactus stereotype"

I want to detect the word that contains two (2) ore more t letters. That mean the words tetris, test and stereotype.

The following regex doesn't do the job because it can;t distinguish words very well.

I thinks I have ti incorporate something like [^ ] in the regex but I wasn't successful...

View 3 Replies View Related

General :: GREP On Words With 2 Or More Z's?

Dec 21, 2010

I need to grep a dictionary file.Only the words that contain 2 or more z's and only 1 b needs to be listed.

View 1 Replies View Related

General :: Grep 2 Words At The Same Time?

Sep 9, 2010

I want to grep any line with "john" or "jack". How to do that? I tried

grep john | grep jack
but it didn't work

View 2 Replies View Related

Debian Hardware :: Can't Seem To Pull Any Info On The Temp Sensors For New MSI H61M-P21(B3) Mobo?

Aug 7, 2011

LM-Sensors can't seem to pull any info on the temp sensors for my new MSI H61M-P21(B3) mobo. Is MSI just not Linux friendly? Or could it possibly be that there really are no temp sensors on this board? I must be missing something simple here

View 9 Replies View Related

Ubuntu :: Output Of Command In Less And The Words Highlighted By Grep?

Sep 1, 2010

So theres this command

Code:
man -k mail
Which lists commands that contain the keyword "mail" in their description.I want the output of this command in less and the words highlighted by grep. Something like

Code:
man -k mail | grep mail | less
The command doesn't work, how do I fix it?

View 2 Replies View Related

General :: Use Grep To Find The Words In The Dictionary?

Dec 1, 2010

I'm trying to use grep to find the words in the dictionary that contain the letters "th" and the letter m.

I tried grep 'th m*.' Desktop/Dictionary/words(Thats where the destined dictionary word document is located)

grep 'th' Desktop/Dictionary/words works but only for the words with th. I have no idea of what expression to use to make it a unionized expression with m

View 3 Replies View Related

Programming :: Tail The Message Log| Grep - Several Words - Play A Sound When It's Found

Jul 4, 2011

I'm trying to write a script that will either tail or watch /var/log/messages for the words

PHP Code:

signal Gone into alarm state

From this line below.

I would then like the script execute:

And have run at start up.

I'm stuck with grep-ping only one word

PHP Code:

View 14 Replies View Related

Ubuntu :: Regex In Grep - Match With Any Character Combination

Dec 10, 2010

regex in grep? I need to match ANYTHING in the following with any character combination (something like * in findstr in C): grep "Delivery of nonspam" /var/log/mail.log | grep "to [URL]"

View 1 Replies View Related

General :: Use Grep To Match Domain Names?

Jan 10, 2011

I have a list of urls like code...

How can I use grep to match the domain names only?

All the urls have a / after the domain. And there are a lot of tlds, not sure how many, the list is quite big.

View 3 Replies View Related

General :: Get Files That Match ALL Patterns (using Grep)?

Jun 9, 2010

I want to traverse a directory and get a list of files that contain a set of patterns. I assumed I could use grep for this, but I having trouble getting grep to only return files that match ALL patterns. Here's what I've come up with so far:

Code:

grep --recursive --file=searchpatterns.txt --files-with-matches somedirectory/*

However, this gives me a list of files that match ANY of the patterns in the searchpatterns.txt file. I want to match ALL of the patterns. I've looked through the man page, but can't find anything that allows me to change the "OR" to "AND" for multiple patterns.

View 5 Replies View Related

General :: Use Grep To Match Multiple Lines?

Feb 3, 2011

I have done this before but i cant really recall now

I have a text file and i want to grep the word "interface" and 10 lines following it. I think there was some switch like grep -A or something ?

View 2 Replies View Related

Programming :: Using Grep To Find EXACT MATCH?

Nov 11, 2010

I'm trying to find exact matches of some users in the /etc/passwd file using "grep -w", but it doesn't always work. For example, I have the following users:[URl].. So, let's say, I want to search for the user "stewart" (which doesn't exist)

[Code]...

View 13 Replies View Related

General :: Searching Files For Specific Words Or Phrases

Jan 31, 2011

I have word like initialize_my_var:in sample.php and I included three library files, take it as a.php, b.php, c.php ,I really don't know where my label(initialize_my_var:)definition is present in my library files, is it possible with a pattern matching string to find which library file really have the exact term "initialize_my_var:" , I'm really looking for an exact pattern match.

View 1 Replies View Related

Programming :: Substitute Few Words + Change All The Lines Starting With A Specific Word + Put Blank?

Jan 17, 2009

I have an old-address-list file which is having around 1500 entries. I need to convert this addresses in to a specific format.

The old-address-list file>
# cat old-address-list-file
dn: CN=Muhammad Hadhi K.M,OU=IT Dept,OU=Example Company H.O,DC=example,DC=com
cn: Muhammad Hadhi K.M

[code]....

View 6 Replies View Related

Ubuntu :: Can't Install Update-info-dir File Is Missing From /var/lib/dpkg/info/?

Aug 6, 2010

so i cannot install anything because update-info-dir file is missing from /var/lib/dpkg/info/ .. I've searched for the last day and a half for a way to fix this, but nothing. can't even update dpkg because of this. so how do I bypass or fix this so I can install stuff (this is a fresh install of ubuntu 10.04 lts Lucid Lynx).

View 9 Replies View Related

Ubuntu :: Get Hardware Specific Info About A /dev?

Nov 23, 2010

Is there a way to get hardware specific info about a /dev?I have added a data acquisition board, and, I don't know if it has shown up in the /dev list, or how to make it do so, or even if I want it to.It is located at address 0x300, but I don't know how to get that kind of information from something listed in /dev.I have a program that accesses the board and it is working fine, but I need to run the program as root (sudo acquire_program).I have been reading about groups and permissions and there may be a way to give access to a /dev/something to a program (or group)

View 1 Replies View Related

Ubuntu :: Window Animation (compiz) - How To "grab" Pull-down Menu Window Info

May 13, 2010

Some of my applications use different window types for pull-down menus than what compiz window animation think. This means that I get normal open window animation on these pull-down menus instead of the menu-theme. Inside the CompizConfig you can specify exactly which window types the different animations apply to, and you can use "grab" to probe your window for this info. My problem is that I can't "grab" the info for the pull-down, since it leaves "grab" mode once I try to open the menu (and grabs the info for the parent window instead of the menu). How do I get to know the window properties of the pull-downs, so that I can map them to the relevant window animation theme?

View 5 Replies View Related

Ubuntu :: Mssql_connect ERROR With No Specific Info

Mar 30, 2011

I'm trying to read our companies mssql ordertracking db using php's mssql_connect. I was able to make this work when using WAMP, and I had done so by adding the same user on both machines and then applying that user name to the WAMP service. Because of viruses and poor performance... I moved the site over to ubuntu server and I have to say i am very pleased, other than I cannot make a connection to mssql now. I installed sybase5 and can see mssql is available via phpinfo. It's using freetds. I know all my connection info is correct. I can ping the machine that has mssql from the new webserver. When i try to view a test php connection page it returns nothing but a null response, and my error log just says ERROR with no specific info. I did however find out that /tmp/freetds.log returns a bunch of jibberish. ubuntu forum isn't letting me submit the whole log, so i put it on sendspace here [URL]...

I did jack around with odbc_connect but still couldn't get it to work... I feel like I am close with mssql_connect but there is some user authentication problem. why it won't return any info from the mssql db. Also I was wondering if something similar can be done with ubuntu where i applied a user to the WAMP service on my windows machine which then was able to connect to the mssql db.

View 2 Replies View Related

Programming :: Input File - Grep Within Grep

Nov 22, 2010

I need to kind of grep within grep. My input file would be something like:

[Code]....

and I need to find the first occurrence of hello before MY PATTERN (hello 9008 in this case), so the output should be:

[Code]....

View 4 Replies View Related

Ubuntu :: Filter Specific Text From Source Code With Grep?

Feb 27, 2011

I'm working on a new conky script, and I had the idea to use text from a [URL]... The command I'm using to pull the file is:

Code:
curl -s http://www.thefuckingweather.com/?zipcode=33186 | grep 'ITS FKING *'
However, this gives me the entire line of code this line appears in.
Code:
<br />ITS FKCING NICE</div><div id="remark"><br />
How can I limit this to simply the text?

Sorry about the foul language btw...the words obviously aren't misspelled when I enter them in the terminal

View 5 Replies View Related

General :: Stop Search Param In Directories By Grep Immediately After Param Match

Jun 17, 2010

I use the following command to find under /var some param in my script

grep -R "param" /var/* 2>/dev/null |grep -wq "param"

my problem is that: after grep find the param in file grep continue to search until all searches under /var/* will completed

How to perform stop immediately after grep match the param word

For example when I run the: grep -R "param" /var/* 2>/dev/null |grep -wq "param"

grep find the param after one second.

But grep continue to Search other same param on other files and its take almost 30 seconds

How to stop the grep immediately after param match?

View 1 Replies View Related

Programming :: Match With A String Containing Literal Dot "." With Grep Command?

Mar 17, 2010

I want to find out into some directory, all the files which names are composed of : A specific word README, a litteral "." and any string

file name sample like: "README.string"

View 5 Replies View Related

CentOS 5 :: Do I Need To Build Rescue CD Containing Directory Info Of Specific System?

Sep 14, 2010

I have been reading about rescue CD's but haven't found out whether I can make one using my currently running Centos(centos-release-5-4.el5.centos.1 ).I tried to use a Centos cd we have here and it looks fine till it asks where the 'tree' structure is located, when I select cd it ejects it and asks the same question again. Do I need to build a rescue cd containing directory info of my specific system?This is related to wanting to fsck my file system.

View 3 Replies View Related

Programming :: Pull The IPs One By One From The File And Then Ban?

May 4, 2010

Code:
#!/bin/sh
egrep -o 'SRC=[[:digit:]]{1,3}.[[:digit:]]{1,3}.[[:digit:]]{1,3}.[[:digit:]]{1,3}' /var/log/messages | sed 's/SRC=//g' | sort | uniq > /badips.txt

[Code]....

how do i pull the IPs one by one from the file and then ban?

View 1 Replies View Related

Programming :: Bash File Comparing - Report How Many Matching Words My Main File ?

Jun 9, 2009

I have been messing with diff and grep for 2 days now without result

I am trying to match a file consisting of words to many separate other wordfiles in a specific directory. one by one.

What i want the script to do is to report how many matching words my main file has with every file in the directory, each in turn

setup:

Each of em are plain text files with 1 word per line

Output should be something like:

SCRIPT REPORT:

View 8 Replies View Related

General :: Pull String From A File Into A Variable Using Bash

Aug 6, 2011

I have a file (.tmpfile) and inside it is a string which i only know part of, the rest being a random group of characters... I would like to know how to pull the whole string out of the file and into a variable.

View 13 Replies View Related

Ubuntu :: Finding Words In File?

Apr 28, 2011

Is there a command that could be used to find word content in a file? I.e I want to find all files containing the word 169.254.0.0 in /etc directory.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved