In a Git code repository I want to list all commits that contain a certain word
I tried this:
git log -p | grep --context=4 "word"
but it does not necessarily give me back the filename (unless it's less that 5 lines away from the word I searched for.
I also tried
git grep "word"
but it gives me only present files and not the...
If I want to essentially grep every line ever in the repository, is there a way to do it? I know this would take a long time for large projects.
If not all inclusive, at least just the current branch and its entire source history?
Edit: I should have been more explicit. What if I don't have direct access to the server that the CVS repo...
I usually use the following pipeline to grep for a particular search string and yet ignore certain other patterns:
grep -Ri 64 src/install/ | grep -v \.svn | grep -v "file"| grep -v "2\.5" | grep -v "2\.6"
Can this be achieved in a succinct manner? I am using GNU grep 2.5.3.
...
I am trying to debug some errors in a live Merb app. There are a lot of lined of error code running by, but I jut need to see the first one. I can use grep to select these lines and print them but it closes as soon as it reached the end of the file.
What I would like to do is use grep like the shift-F mode in less where it will keep t...
This zgrep command is outputting a particular field of a line containing the word yellow when given a giant input log file for all 24 hours of 26th Feb 1989.
zgrep 'yellow' /color_logs/1989/02/26/*/1989-02-26-00_* | cut -f3 -d'+'
1) I prefer using a perl script. Are there advantages of using a bash script?
Also when writing this sc...
Is there a way to take text like below (if it was already in an array or a file) and have it strip the lines with a specified date range?
For instance if i wanted every line from 2009-09-04 until 2009-09-09 to be pulled out (maybe this can be done with grep?) how would I go about doing so?
date,test,time,avail
2009-09-01,JS,0.119,99....
Ever since I installed emacs on a new machine I have seen an ugly behaviour. Unfortunately, my old .emacs files are rather fragmented and I can't determine whether I used to have elisp that took care of this.
The problem is this: it used to be that when I performed a command that would open a new buffer such as grep'ing, or clicking a f...
I like to get window pid (only firefox) from wmctrl, i tried wmctrl -lp | grep Firefox | awk -F" " "{print $1}" but output not match my expect. Help please.
beer@beer-laptop# wmctrl -lp
0x0160001b -1 6504 beer-laptop x-nautilus-desktop
0x016000bd 0 6504 beer-laptop conference - File Browser
0x03e00003 0 0 N/A XBMC Me...
Hi all -
I'm new to sed and awk - so I'm not really sure which is the most efficient way to go about this.
I'm looking to extract the first two letters of a string. I could do it if they were going to be same every time, but I can't seem to figure out how to just say,
Take n positions of this string from this larger string x.
IE.
US...
Is there a similar utility to grep available from the Windows Command Prompt, or there is third party tool for it?
...
Hi
I have tnsnames.ora file like
DB_CONNECTION1=
(description=
(address=
(protocol=tcp)
(host=myhost1.mydomain.com)
(port=1234)
)
(connect_data=
(sid=ABCD)
(sdu=4321)
)
DB_CONNECTION2=
(description=
(address=
(protocol=tcp)
(host=myhost2.mydoma...
Is there an easy way using grep (or combine with other standard command line tools) to get a list of all files which contain one pattern yet don't have a second pattern?
In my specific case I want a list of all files that contain the pattern:
override.*commitProperties
yet don't contain:
super.commitProperties
I'm on Windows but u...
I need to search for a pattern in files.
For example the content of the file is below:
3555005!K!00630000078!C!20090805235959!47001231000000!16042296!336344324!A!1!ENG!0!00630000078!NO!00630000078!
3555005!K!204042880166840!I!20090805235959!47001231000000!16042296!336344324!A!1!ENG!0!00630000078!NO!00630000078!
3555005!D!16042296!DUMMY...
Is there a shell equivalent of PHP's preg_match?
I'm trying to extract the database name from this string in a shell script.
define('DB_NAME', 'somedb');
Using preg_match in PHP I could just do something like this.
preg_match('define(\'DB_NAME\','(.*)'\'\)',$matches);
echo $matches[1];
How can I accomplish the same thing in a she...
I have some 150 files and in them I want to remove this following code:
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="/height.js"></SCRIPT>
What I'm doing is:
sed -e 's/<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" SRC="/height.js"></SCRIPT>/ /' file_names
This doesn't seem to work.
I want to remove this script...
I just want to get the files from the current dir and only output .mp4 .mp3 .exe files nothing else.
So I thought I could just do this:
ls | grep \.mp4$ | grep \.mp3$ | grep \.exe$
But no, as the first grep will output just mp4's therefor the other 2 grep's won't be used.
Any ideas?
PS, Running this script on Slow Leopard.
...
I need this grep call:
grep "field3=highland" data_file
to return both results with "field3=highland" as well as "field3=chicago highland".
How can I redesign the grep call to account for both scenarios?
...
I get results like below from a pipeline in linux:
1 test1
1 test2
2 test3
1 test4
3 test5
1 test6
1 test7
How can I use grep to retrieve only the lines where the first column is > 1?
...
I need to extract some data from a CSV file. The CSV is a 2 column file with multiple records. The first column is the date, the second column is the data that needs to be extracted. The first row of the CSV file is the column headers, so it can be skipped. And I've already created the column header for the extracted data's csv file,...
What if I have a string that consists of tuples in brackets and I would like to get the maximum value out of the tuple in Perl? Example:
Input: [everyday,32][hoho,16][toodledum,128][echigo,4]
Output: 128
...