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 206914

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

3
votes
With grep and sed in one line: for i in $(grep -f fileb filea | awk '{print $2}'); do sed -e 's/^C/\nC/g' filea | sed -n "/$i/,/^ *$/p" | grep -v "^$"; done That is: Take the patterns to search … for with: grep -f fileb filea | awk '{print $2}' Insert a blank line before every line starting by C: sed -e 's/^C/\nC/g' filea Take from pattern to blank line: sed -n "/$i/,/^ *$/p" Delete …
answered Feb 23 '17 by Zumo de Vidrio
3
votes
You can do it with: grep "error_has_happened" -A3 logfile.log Where 3, is the number of lines after error_has_happened appearence that will be shown. However, this will also show other process … outputs not only the outputs of the process which sends the error. A more elaborated command that worked for me in a quick test is: grep "error_has_happened" logfile.log | cut -d : -f1 | sort -u …
answered Jan 12 '17 by Zumo de Vidrio
3
votes
You can write the output to a file (with strace -o asd.out) and then grep it: From strace manual: -o filename Write the trace output to the file filename rather than to stderr. Use …
answered Jan 18 '17 by Zumo de Vidrio
-1
votes
2answers
doing it with the following if sentences by using logical OR: HAS_SOME_WORD=FALSE if [ "$(grep -v '^;\|^\[' "path_to_file/config.ini" | \ grep -c '\\some_word')" -ge 1 ] \ || [ "$(grep … -v '^;\|^\[' "path_to_file/configuration.ini" | \ grep -c '\\some_word')" -ge 1 ]; then HAS_SOME_WORD=TRUE else HAS_SOME_WORD=FALSE fi I am avoiding the lines starting …
asked Jan 30 '17 by Zumo de Vidrio
4
votes
As already mentioned in comments you can do it in a single zgrep command: zgrep -c "sent" /home/myname/April/*.tar.gz From grep manual: -c, --count Suppress normal output; instead print a …
answered May 3 '17 by Zumo de Vidrio
0
votes
If you always have the same line format you can simply grep "abc." (or whatever before the point including the point): grep abc. file.txt …
answered Feb 23 '17 by Zumo de Vidrio
2
votes
With grep in every line: while IFS= read -r line; do printf '%s\n' "$line" | grep -o 123 | head -1; done < filename That is: While loop in order to check each line separately. grep -o to get …
answered Mar 15 '17 by Zumo de Vidrio