Each logfile is titled based on the date it was created in the format YYYY-MM-DD.txt. I need to search each file for five different keywords and output five files prepended with the specific keyword and then the original logfile name. Example: Test-YYYY-MM-DD.txt
grep -i -w 'keyword1' YYYY-MM-DD.txt > Keyword1-YYYY-MM-DD.txt
If it's ...
Is it possible to search multiple pdf files using the 'grep' command. It doesn't seem to work, how do people search content on multiple pdf files?
...
I would like for someone to explain this to me:
function myFunction(array){
array = $.grep(array, function(n,i){return n > 1 });
}
var mainArray = [1,2,3];
myFunction(mainArray);
document.write(mainArray) // 1,2,3, but i'm expecting 2,3
but if i do something like
array[3] = 4;
in place of the $.grep line, i get 1,2,3,4. ...
I'm trying to model a phonetic recognizer that has to isolate instances of words (strings of phones) out of a long stream of phones that doesn't have gaps between each word. The stream of phones may have been poorly recognized, with letter substitutions/insertions/deletions, so I will have to do approximate string matching.
However, I ...
I am publishing content from a Drupal CMS to static HTML pages on another domain, hosted on a second server. Building the HTML files was simple (using PHP/MySQL to write the files).
I have a list of images referenced in my HTML, all of which exist below the /userfiles/ directory.
cat *.html | grep -oE [^\'\"]+userfiles[\/.*]*/[^\'\"] |...
fgrep -ircl --include=*.{sql} "[--]" * doesn't seem to be doing the trick. Please help...
Thanks for the responses guys. I am trying to replace the '--' with '#' and am having a tough time. I created a new question here. If you could help, that had be awesome.
...
Ok guys.. I have a HTML i need to parse into a php script and mangle the data around abit. For best explanation I will show how I would do this in a bash script using awk, grep, egrep, and sed through a god awful set of pipes. Commented for clarity.
curl -s http://myhost.net/mysite/ | \ # retr the document
awk '/\/\a...
Hi,
I'm writing a bash script that will show me what TV programs to watch today, it will get this information from a text file.
The text is in the following format:
Monday:
Family Guy (2nd May)
Tuesday:
House
The Big Bang Theory (3rd May)
Wednesday:
The Bill
NCIS
NCIS LA (27th April)
Thursday:
South Park
Friday:
FlashForward
Saturday:...
I have got a file with following format.
1234, 'US', 'IN',......
324, 'US', 'IN',......
...
...
53434, 'UK', 'XX', ....
...
...
253, 'IN', 'UP',....
253, 'IN', 'MH',....
Here I want to extract only those lines having 'IN' as 2nd keyword. i.e.
253, 'IN', 'UP',....
253, 'IN', 'MH',....
Can any one please tell me a command to grep it...
I've searched for this a bit but I must be using the wrong terms - does ruby have a way to grep for a string/regex and also return the surrounding 5 lines (above and below)? I know I could just call "grep -C 5 ..."or even write my own method, but it seems like something ruby would have and I'm just not using the right search terms.
...
Whether we're maintaining unfamiliar code or checking out the implementation details of an Apache module it can help if we can quickly traverse the code and build up an overview of what we're looking at. Grep serves most of my daily needs but there are some cases where it just wont do.
Here's a common example of how it can help. To find...
Say our folder structure looks like this:
/app
/app/data
...
/app/secondary
/app/secondary/data
I want to recursively search /app/data but I do not want to search /app/secondary/data.
From within the app folder, what would my grep command look like?
...
I have a text file where some lines have a character at the beginning and some lines don't. I want to print the text file to screen, excluding the lines that don't have a character at the beginning.
Can I do this with grep?
...
I want to find the lines in which atleast one of the strings among string1 and string2 are present in the file.
grep 'string1' 'string2' file;-this is an error even though!!
how could i do the above on unix command line?
...
I'm not quite sure how best to define/articulate this, but I'm looking for a way to pseudo-spider a website. The key is that I don't actually want the content, but rather a simple list of URIs. I can get reasonably close to this idea with Wget using the --spider option, but when piping that output through a grep, I can't seem to find the...
I have a configuration file that has entries for various devices, with each entry separated by a blank line. I need to search the file for all instances of a given device type, and count the number of non-blank lines following the occurrence, stopping at the first blank.
For example:
Server=foo
config line 1
config line 2
con...
I am a novice Perl programmer and would like some help. I have an array list that I am trying to split each element based on the pipe into two scalar elements. From there I would like to spike out only the lines that read ‘PJ RER Apts to Share’ as the first element. Then I want to print out the second element only once while counting e...
Hi -
In my shell script, I am trying to search using terms found in a $sourcefile against the same $targetfile over and over.
My $sourcefile is formatted as such:
pattern1
pattern2
etc...
The inefficient loop I have to search with is:
for line in $(< $sourcefile);do
fgrep $line $targetfile | fgrep "RID" >> $outputfile
done
I ...
I have a list of files and I'm trying to extract all layer1_*.grd files. Is there a way of doing this in one grep expression?
lof <- c("layer1_1.grd", "layer1_1.gri", "layer1_2.grd", "layer1_2.gri",
"layer1_3.grd", "layer1_3.gri", "layer1_4.grd", "layer1_4.gri",
"layer1_5.grd", "layer1_5.gri", "layer2_1.grd", "layer2_1.gri",
"layer2_...
Hi,
I have a directory which contains several directories as follows:
/Music/
/Music/JoeBlogs-Back_In_Black-1980
/Music/JoeBlogs-Back_In_Black-(Remastered)-2003
/Music/JoeBlogs-Back_In_Black-(ReIssue)-1987
/Music/JoeBlogs-Thunder_Man-1947
I want a script to go through and tell me when there are 'possible' duplicates, in the example ...