Skip to content
Advertisement

Tag: grep

How to filter properly my access logs with GoAccess?

I want to generate a report with only the POST /xmlrpc.php requests, so I run the following command : The results of the report are not all displayed (in the graph I see only 9 days, but I checked on the others logs and I have POST /xmlrpc.php requests almost every days (30 in total) ). Am I using zat

Doesn’t show the needed info from auth.log file when using grep

I want to get all info about user from auth.log file, but when I use grep user /var/log/auth.log but instead of giving me all the information with user mentioned, it just writes to me Binary file /var/log/auth.log matches. It used to pick up the sentences with mentioned user, but now it doesn’t. Answer Sounds like your auth.log has some garbage

Regex Pattern matching refinement

I have a json that is returned to a variable, I’m trying to only grab values of from the json. I’m only limited to grep, sed, and awk returns me the result and honestly the only part I want is Answer With jq, you could use ‘.results[0] | .path’ filter. You may play around with this tool online here. However,

Pcregrep include file extension bug

I’m using pcregrep to search for a multiline pattern, and I only want pcregrep to search through files with specific file extensions, i.e. pcregrep -Mrl –include=*.sv -e ‘<my_multi-line_pattern>’ /path/to/search However, this throws an error: pcregrep: Error in ‘include’ regex at offset 0: nothing to repeat. I’ve tried escaping & double-escaping the * to no avail. This syntax seems to work

Searching and selecting strings from a file

I have a trouble in separating few exact ‘fields’ with strings and then putting them into .txt file. I need to extract ‘nologin’ users from /etc/passwd file and that is an easy step. I’m using this command: cat command gives me for example: and it is saved to file1.txt Now I have to extract from file1.txt a number (2, 3,

Finding emails from one file in another

I want to find emails from one file listed as such: in another file listed as so: and output the lines from the second file that match with the first file also keeping in mind it needs to match the entire email from start to finish so it won’t match robertjohn@blogs.com accidently. Desired output: Thanks! Answer With grep, get the

Using variables on grep –q doesn’t produce founds

I need to extract entries from a log file and put them on an errors file. I don’t want to duplicate the entries on the errors file every time that the script is run, so I create this: And is run using: The first time that the script runs it finds the entries, and create the errors file (there are

Match unknown substring with RegEx

How can I get an unknown substring with an regular expression? I know what’s before and after the wanted string but I don’t want the known part with in the result. Example text: I’m looking for ‘SOMETHINGHERE’ and ‘SOMETHINGELSE’ only. vocher_ and .db are always before and after the relevant part but should not be in the result. A working

Advertisement