- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- grep: not enough memory ???
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-26-2002 07:58 PM
тАО02-26-2002 07:58 PM
grep: not enough memory ???
seems I am starting eat live and dream HPUX .. fun huh ..
Well we are trying to cat and grep a huge file.
154082574 Feb 26 21:50 radius.log
When I try to grep .. I get this error
cat radius.log | grep spr8345409a1
grep: not enough memory
I can grep a smaller file but I cant get that big file. Does grep have limits? Any other way to look for a string in a huge file?
Thanks,
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-26-2002 08:02 PM
тАО02-26-2002 08:02 PM
Re: grep: not enough memory ???
Try this perl script:
#!/usr/bin/perl
open (FILE, "radius.log");
while (
{
if /spr8345409a1/
{
print "$_\n";
}
}
Btw, what is your maxdsiz and ulimit?
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-26-2002 08:20 PM
тАО02-26-2002 08:20 PM
Re: grep: not enough memory ???
0x04000000
Calculated Value: 67108864
ulimit -d
65536
Do I need to bump ulimit?
And will a cat file | grep whatever
use allot of cpu ?
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-26-2002 08:55 PM
тАО02-26-2002 08:55 PM
Re: grep: not enough memory ???
Does the perl script work for you? If it worked, then it was probably a grep limitation.
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-26-2002 09:39 PM
тАО02-26-2002 09:39 PM
Re: grep: not enough memory ???
I would first try:
grep "spr8345409a1" radius.log
If this comes back with "not enough memory" then try feeding it to xargs like this:
ls radius.log|xargs grep "spr8345409a1"
Thanks,
Shabu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-27-2002 07:19 AM
тАО02-27-2002 07:19 AM
Re: grep: not enough memory ???
syntax error at ./perl.scr line 5, near "if /spr8345409a1/"
syntax error at ./perl.scr line 9, near "}"
Execution of ./perl.scr aborted due to compilation errors.
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-27-2002 07:21 AM
тАО02-27-2002 07:21 AM
Re: grep: not enough memory ???
This could be swap so check your syslog.
Also try the old do loop to slow it down
cat file|while read line
do
echo $line|grep spr8345409a1
done
Steve Steel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-27-2002 07:23 AM
тАО02-27-2002 07:23 AM
Re: grep: not enough memory ???
if ( /spr8345409a1/ )
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-27-2002 07:29 AM
тАО02-27-2002 07:29 AM
Re: grep: not enough memory ???
Here is what the perl script gave me ..
./perl.scr
Out of memory during "large" request for 67112960 bytes at ./perl.scr line 3.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-27-2002 07:38 AM
тАО02-27-2002 07:38 AM
Re: grep: not enough memory ???
If this is the case, you can use perl to do binary reads, reading in a block at a time and scanning that block.
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-27-2002 07:45 AM
тАО02-27-2002 07:45 AM
Re: grep: not enough memory ???
Is this a binary file? Grep is suppposed to be line oriented and I know I have grepped things out of files in the 1 to 2 gig range, but they were text files with newline characters embedded.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-28-2002 02:36 AM
тАО02-28-2002 02:36 AM
Re: grep: not enough memory ???
Other reports indicate that maxdsiz should be greater than the file's size, which, as far as I can tell is not the case in your case.
Yet other reports use split(1) to split the file into smaller pieces and grep the pieces. May be you can use this trick to see if maxdsiz is indeed the likely culprit.
Just to be sure: This is a *text* file, right? I.e. a file with lines ending with a newline character and with line lengths less than 2048 bytes (see glossary(9) and limits(5)). If not,you may want to use fold(1).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-28-2002 05:19 AM
тАО02-28-2002 05:19 AM
Re: grep: not enough memory ???
With all those memory requirements passing by, a question might be apropriate: Are the `lines' in radius.log separated by newlines, or by something else? If there are no newlines, most unix utilities will fail, because they work line based.
GNU grep works block based, and perl works line based by default, but can easily be told to work block based or accept any record separator you like.
with perl you might get better results in setting the input record separator to something /not/ in the pattern. But that still leaves the question: what should be printed if the lines are not newline separated?
perl -ne '/spr8345409a1/ and print' radius.log
for a much simpler version than all perl examples given, and a safer version could be
Steven's version has some bugs (apart from the missing () in the if):
#!/usr/bin/perl
open (FILE, "radius.log");
while (
if (/spr8345409a1/) {
print "$_\n";
}
}
1. open FILE, "< radius.log" or die "radius.log: $!";
always check the return status of the open, reading from a not opened handle might be surprising
always open files for reading using "<" in front to prevent strange and unwanted effects:
my $x = "radius.log"
open LOGFILE, $x;
care to think what would happen if $x came from the outside world and contains "| xargs rm -rf /"?
2. print;
perl reads /lines/ separated by newlines (at least on unix) but does not strip them, so $_ still has the newline at the end. $_ also is the default to print, so 'print;' should suffice in this case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-28-2002 05:56 AM
тАО02-28-2002 05:56 AM
Re: grep: not enough memory ???
I was just goinf to suggest you getting GNU's grep, but procura beat me to it. Like stated, it will do block scans. The issue is also that you are trying to "display" the "block" of data containing your "string", and if the start of this block (last NewLine) was a few meg's ago (and let's not forget where the block ends - yes, at the next NewLine), you are going to get a lot of crap on your screen.
live free or die
harry