5
votes
1answer
351 views

How can I perform a second grep on the files returned from a previous grep?

I often find myself searching through a bunch of code using grep in order to pin down what I'm looking for. Sometimes I get a list of files a little longer than I hoped. At this point I want to ...
1
vote
3answers
48 views

Is there anything grep does better than ack? [closed]

I started using ack a while ago and it's amazing, but still begs the question: Is there anything grep still does better than ack? Or maybe is there something grep does that ack can't do?
3
votes
2answers
725 views

How to search a text file for strings between two tokens in Ubuntu terminal and save the output?

How can I search a text file for this pattern in Ubuntu terminal and save the output as a text file? I'm looking for everything between the string "abc" and the string "cde" in a long list of data. ...
1
vote
2answers
138 views

Why is my recursive grep not working?

I am in a parent directory and want to search for any ODT files (LibreOffice Writer) that contain the phrase "GWT" in them. I'm on Ubuntu 12.04 desktop. From the terminal: ...
0
votes
2answers
145 views

Replace a Paragraph After a String

I have a text file with a lot of lines and paragraphs I want to replace a string with a line of string Example: Old Text File Sometexts New Text File Sometexts With Some Lines Paragraphs and ...
0
votes
1answer
1k views

Using Mac OS X terminal to copy a selection of folders to a new location, with merge behavior

I have a folder 'foo' that contains a lot of sub folders, e.g. foo |---20101 |---20102 |---20103 |---20111 |---20112 |---20113 There are way more than this, but hopefully it explains the ...
0
votes
2answers
764 views

Terminal highlight error when compiling with a make file

I have a simple make file and I want to highlite the word or line that contains "error:" to make it easier to see. I am SSH via Putty to the linux machine which may cause a problem but currently I ...
2
votes
1answer
331 views

What's *nix terminal command to find and remove found files?

I have a malware on my server. So I've figured out how to find all that malicious files grep -r --include*.php "Some String from files" . That seems work fine! but how to delete them? I've tried ...
3
votes
2answers
399 views

How can I retain grep's match highlighting when piping find into grep?

If I run grep foo bar.txt, grep highlights each occurrence of "foo" in bar.txt. But sometimes I want to use find to determine which files grep searches. So I do something like this: find . -iname ...
4
votes
2answers
2k views

Grep in Mac OS X's terminal — only displaying one color

I am used to grep being able to color the filename, the line number, and the match itself. These three ought to be different colors. This works flawlessly on a Linux terminal and even MinGW on ...
7
votes
1answer
4k views

How can I grep with color in Mac OS X's terminal?

I recently found that on Mac OS X I can set this up in my shell ~/.profile so that when I use grep it will print the matches in color (white one red). alias grep='GREP_COLOR="1;37;41" LANG=C grep ...
0
votes
1answer
636 views

Using grep to move files, Mac

I want to do a search using grep inside all the files of a directory for the pattern '@mail.ru>' (to clean up a mess from a spammer). Using Mac OS X's command line, which should be similar to most ...
1
vote
2answers
310 views

List all files in a directory matching a string and copy output

I'm trying to create a series of playlists on my MP3 player, running Rockbox, by finding a file matching a string, using find /cygdrive/g/MUSIC -type f -name "Search Criteria" | ...
3
votes
3answers
224 views

Bulk renaming files [duplicate]

Possible Duplicate: How can I mass rename files from the command line or using a 3rd party tool? So I have a series of files with the following format Their real file name followed by the ...
1
vote
1answer
485 views

How to print only an IP address list of traceroute?

How do I print only an IP address list of a traceroute run? I don't want the web addresses like something-online.net and their round trip times. How do I get a "simple" traceroute from the ...
2
votes
1answer
2k views

Using regular expressions in Linux with grep

I can't get this simple regular expression to work for matching emails: '\w*(?:\.\w*)*@\w*(?:\.\w*)*\w\{2,5\}' It should be working as I have tested it with regex pal and it works just fine. I ...
0
votes
3answers
808 views

Mac OS X Terminal: Search output of another command with grep

I am trying to get the output of an ls command and search that list for a regex expression... Effectively, it will search every file name in the folder for the regex expression. I put together a ...
4
votes
3answers
4k views

How can I find all files in a folder with a certain text string and an extension?

I am using OS X. I need to find files in a directory with the .php extension and the string 41 somewhere in the file's contents. I tried using grep. grep -R 41 *.php This however only seemed to ...