I have a large JSON file that is on one line, and I want to use the command line to be able to count the number of occurrences of a word in the file. How can I do that?
Here's an example of a grep command line I've tried: grep '(565172|565173|565175)' /var/log/cups/error_log It doesn't produce any output, even though all 3 values are in the file multiple times. I ...
Why do brackets in a grep pattern remove the grep process from ps results? $ ps -ef | grep XXXX [...] XXXX [...] grep XXXX $ ps -ef | grep [X]XXX [...] XXXX
I have a bunch of directories. Inside these directories is a cover letter and a zip archive of work. I wanted to run a quick and easy query to open up all the cover letters so I can decide if it's ...
I have a file in which I need to eliminate everything after the first ; on every line. So a file like this: sdfsdsdf; fsdfsddf;sdfsd; Will result in this: sdfsdsdf fsdfsddf I have looked into ...
When I tried searching for a string within a file, the results didn't include those that were enclosed in single quotes. For example: grep -rn text folder/ The results didn't include strings the ...
Say I have the following file: $ cat test test line 1 test line 2 line without the search word another line without it test line 3 with two test words test line 4 By default, grep returns each ...
Are there alternatives to pgrep and pkill commands on Mac OS X or should I just create aliases for them using other commands available for me?
I have seen on some Linux, that grep is configured to highlight the match, and print the matching file. How can I configure grep to highlight matches?
Maybe it's a bit strange - and maybe there are other tools to do this but, well.. I am using the following classic bash command to find all files which contain some string: find . -type f | xargs ...