grep is a command-line tool for searching text patterns in files
4
votes
4answers
115 views
Most efficient grep method
Currently I am grepping data from a file containing any of the following:
...
2
votes
3answers
36 views
Extract integers enclosed in round brackets
I'm new to Linux. I've a file which contains list of movie names and their release year. I want to list out all release years. Specifically my file looks like below
TDKR(2012)
Vicky Cristina ...
2
votes
2answers
35 views
Parse apache logs to exclude IP ranges
I need to look for some requests in a huge pile of apache logs. My only requirement is this:
I need to only view the requests coming from any IP address that is NOT included in a list of 50 IP ranges ...
1
vote
2answers
45 views
Match a simple Regex
I need to match this: (tt\d{1,10}) in a file with the file ending txt.
I have tried grep and ack-grep but without results.
ack-grep -G \.txt$ -g "(tt\d{1,10})"
1
vote
3answers
50 views
solaris 10 + display 2 lines after match by grep?
I want to match for example:
The string e1000g0 from the lltconfig -a list , and then to display the two lines after the string e1000g0
so I get only the lines:
Node 0 du1a : ...
2
votes
0answers
69 views
Web front-end to find/grep/ack
In my lab, we are trying to build a web that allows the user to enter queries for find, ack, grep on a specific directory. The web would return an HTML with a table of a list of clickable files (click ...
6
votes
2answers
283 views
When is it useful to use “grep — SOMEPATTERN”?
So under Linux/AIX where ever.., when is it useful to use:
grep -- SOMEPATTERN
the Question is the "--" part. When is it usefull to use?
0
votes
4answers
89 views
How to detect dos format files in git bash
Git Bash is a nice bash shell you get in Windows as part of the installation of Git. It comes with other typical unix tools bundled inside, such as grep, sed, awk, perl. It doesn't have the file ...
5
votes
2answers
117 views
What is the difference between grep -e and grep -E option?
I am trying to understand the difference between grep -e and grep -E. Now from grep manpage I got:
-E, --extended-regexp
Interpret PATTERN as an extended regular expression (see below).
...
1
vote
1answer
72 views
The simplest method to count lines matching specific patterns, including '0' if line is not found?
I have very big logs (several gigabytes per day), that can (but do not need to) contain specific lines. I have to count the number of occurences of every one of these lines on a daily basis.
I have a ...
2
votes
5answers
64 views
Generate “item tag” pairs from “item,item,…|tag” lists [closed]
The characteristics of the input data:
Each line consists of two fields, separated by a pipe '|', where
the first field is a comma-separated list of items, and
the second field is a tag.
Input
...
4
votes
3answers
109 views
Delete the matching line and several more from a file
I have a text file called file_a.txt.
My first command is
grep -A 12 ".production =" file_a.txt
The output is a few block.
Each block of string contains 13 rows
I specifically want to delete all ...
2
votes
2answers
69 views
How can I enhance the output of find and grep?
I really don't look forward to having to do find/grep because the output, as returned by
find . -exec grep sometext {} \; -print
is just not very easy to read even when you dump it in a file. What ...
10
votes
6answers
310 views
How can I grep a directory based on the contents of two successive lines?
How can I grep a directory for lines that contain "Foo", but only get matches when the next line also contains "Bar"?
3
votes
2answers
118 views
how to grep for c:\
I'm using cygwin's grep to find all instances of hardcoded paths on c drive.
doing:
grep -r "c:\\" .
gives grep: trailing backslash
Does anybody know how I can do this?