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
Tag: grep
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,
How to display a few line from the last few lines for a given number of files?
I have a folder with many different files. I want to display a specific line from the last 100 line of a list of files. So far I have tried both Grep and Tail but neither gave me exactly what I want: Example: the folder has the following files: file_1.txt file_2.txt file_3.txt other_file.txt other_file2.txt Content of file_n.txt is: line 88:
How do I grep or sed in a continuous stream of characters?
I have a program that output some text and then a continuous stream of characters: I want to exit this program as soon as “A” is seen in the output and I tried: However, it seems like grep doesn’t see the “A”s until the perl program exits. I also tried with sed with no luck; Any ideas how I can
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