Skip to content
Advertisement

Tag: grep

Grepping Numbers With Decimal Places

I’m trying to figure out how to grep a time stamp read from a file that consists of a number with a decimal, but I can’t seem to get the output I’m looking for, any help would be great! Thanks in advance. Example: The result should be: What I’ve Tried: Answer you can use awk to split the file to

finding number of occurences in large text file in linux

I have a 17 GB txt file and i cannot seem to load it via vim. Researched on solutions provided here. However i do not seem to understand them very well and i am not good with linux or perl. I understand i would have to use grep or something. I have tried up to this code but i cannot

Grep regexp for matching ip addresses in a file

I’m trying to search a file “Sessions” that contains IP addresses (among other useless junk). My Grep is failing to match, even though REGEXR is matching perfectly all the IPs perfectly … so I know the REGEX is correct … but when I GREP for this same pattern, not is returned. I’ve tried a variation of ways on that GREP

Shell : choosing string between two strings using sed

I have a log file in format like this : I want to return all the strings which are between pseudo and pseudoConcat, my desired output is : How can I do this using sed or awk? I’m trying for a few days in vain. Thanks. Answer With GNU grep: Output without trailing spaces: thierry33 i love you With bash:

linux: how grep work

I am using grep for some time,but there is some question when I use grep. when I use ‘grep’ to search some string on nginx error log,I try two ways: one: for this,there is nothing find two: for this, there can find lines that contain 404 in error.log in my example, ‘404.*’ is the pattern,based on the result,I think when

Is there a bug in “zgrep -H”?

Just tried grep and zgrep on following test file: I also need the file-name printed, so I’ve added the -H switch and stepped on the following problem: E.g. depending on POSITION of -H switch in the command-line – the behavior is different for me and the issue always reproduces 🙁 One more test: Here’s the outline of which zgrep I’m

How to grep a particular pattern

I am trying to get a particular pattern, but i get the result for all possible solutions I did try all the solutions available here How do I get only the PID: 467? Answer If your goal is to grep only for “lubuntu”, not “lubuntu-somethingelse”, then you can add a space afterwards: Or without the extra commands: Edit: If you

for loop syntax with grep in bash

I want to do text processing for lines in file.txt that ends with 0, I wrote an easy form of it to ask my question clearly. I want the output to be: 1 343 4352 0 432 432 2345 0 I want $i variable to be “1 343 4352 0” and after that to be “432 432 2345 0” but

grep first n rows, return file name only

I can do the following to search for what I need and return the file name: grep -l “mysearchstring” ./*.xml However the files I am searching are huge so this takes forever. The string I am searching will appear in the first 200 rows so how can I search only the first 200 rows and still return the file name?

Advertisement