Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 143456

grep is a command-line tool for searching text patterns in files

5
votes
You can start a sub shell and use $0 variable to do this. bash -c 'echo "$0: $(grep -c $0 example.txt)"' 'Thenis' > example.lst …
answered Jan 16 '16 by Munir
4
votes
I don't know about ack-grep but you can use find to exclude files larger than 3MB. find . -size -3M -exec grep "foo" {} \; …
answered Feb 26 '16 by Munir
0
votes
If there are no other lines in the file, var=$(awk -F. '{print $1}' filename) will do what you want.
answered Apr 13 '17 by Munir
0
votes
You'll have to use echo to pass the $i to awk. Otherwise it looks for a file. A=$(echo $i | awk -F_ '{print $1}') Same with B
answered Jan 14 '16 by Munir
1
vote
You can pipe the output of tcpdump to a file through a background process and then use tail -F <file> --pid=$! to follow it. So, something like tcpdump ... > tcpdump.log 2>&1 & tail -F tcpdump.log --pid=$! | grep -i --line-buffered "..." | cut -d '&' -f1,2 …
answered Mar 8 '16 by Munir
2
votes
Use | which is "or" operator for regex in the grep command. Also, no need for cat. grep can read from file directly. grep '^Name:\|^Email:' filename …
answered Mar 22 '16 by Munir