I'm testing nginx-cache-purge and notice that grep searches all file content, and since the cache key is in the second line I would like to limit grep searching.
This is the script I'm using:
github.com/perusio/nginx-cache-purge
The line I would like to change and limit grep search to the Second line is:
Seaching in google I found out that the command head -n can help me with this, but I can't get it to work.
nextfile is not part of posix awk, but it's available on the most popular implementations.
AWK uses extended regular expression, instead of grep's basic flavor. You may need to tweak your regular expressions if they're more complicated than a simple word like "topic".
Since this find prints file, and since you almost certainly don't want to spawn awk once per file, I dropped -n 1 in xargs. Further, sometimes parallelizing i/o bound tasks can degrade performance if the parallel invocations are not backed by different disks. Something to keep in mind. You might actually improve performance by lowering the value of -P (if not by eliminating it altogether).
I am trying to find files that have lines in them that end in an r. I have been able to locate files by using the following command:
find . -type f -name "*RECORDS"| xargs grep -l r$
However, I now want to find files that don't end in r anywhere. That means that no sentences or lines in... (9 Replies)
hi guys
how can i limit number of files in a disk or partition ?
or how can i make a limit to inode number for a disk or partition ?
ext3 or ext4 file system (1 Reply)
Hi
I am in new in unix,can any one tell how to grep the data by limit.
suppose I have below data:-
is :mSecs
is :mSecs
is :mSecs
is :mSecs
requirement is how to grep the data which is having count greater than 1000 msecs only.
thanks in adnavce. (2 Replies)
Hi all,
I am still learning my way around unix commands and I have the following question.
I have a website and I want to search for all the html pages that don't contain a certain js file. The file I am searching for is located under /topfolder/js/rules.js . So I assume in my grep search I... (5 Replies)
I am doing an ftp of around 1010 files and I am using mput for this. For some reason its only transferring 10 or 20 files and the rest are
not getting transferred. There is some socket error in the log. is there an issue if we have more than 50 or so files for mput.
here is the o/p in the log... (2 Replies)
I want a shell script which does:
-> search all .mov files in a drive (say e: drive) which are above 800 mb of size
-> Delete the searched .mov files which are above 800mb
Thanks,
Manoj (4 Replies)
This may just be a lack of experience talking, but I always assumed that when possible it was better to use a commands built in abilities rather than to pipe to a bunch of commands. I wrote a (very simple) script a while back that was meant to pull out a certain error code, and report back what... (4 Replies)
I want to serch for a string in all the files in the root directory. i want the search to be limited to only the files in the directory i.e the search to be done only in the files not in the sub directory.
the approaches tried are
1)grep "pattern string"
this command was serching the... (3 Replies)
Hi Friends,
I am having a funny problem with grep. When I run
grep 'expr' file.txt
things work fine. But when try to get the line number using the -n option, i.e,
grep -n 'expr' file.txt
I get a message, "grep: 0652-226 Maximum line length of 2048 exceeded."
If the line has more than... (3 Replies)
in aix, i use grep something * to get the files, lines that contain something. but i couldnt get the same result from a sun box. what is the equivalent? thanks (4 Replies)