The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 02-05-2007
Registered User
 

Join Date: Jun 2006
Posts: 39
Lightbulb Awk help

I have a pattern that I need to search in a BIG file.

This is the command I am using

Code:
awk '/EA2/ { print $0 }' filename
The error message that I get is :

Code:
awk: 0602-561 There is not enough memory available now.
 The source line number is 1.
I am guessing the file is too big and that is hwy I get this particular message. I wanted to check if there were any other ways to go about getting this thing going. The file is a fixed width file and the pattern 'EA2' occurs at 94-96.
Reply With Quote
Forum Sponsor
  #2  
Old 02-05-2007
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
I think all the records are in single line without the newline character.You can try fold command and awk it.
Reply With Quote
  #3  
Old 02-05-2007
Registered User
 

Join Date: Jun 2006
Posts: 39
Exclamation

Yes the file is a mainframe file so everything could be on one line. I tried this:

Code:
fold -w 150 filename | awk '/EA2/ { print $0 }'>/home/test/EA2.dat
But the file EA2.dat comes out to be a 0 byte file. Also I wanted to maintain the format of the source file. Is there any way to do this?
Reply With Quote
  #4  
Old 02-05-2007
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
Check whether EA2 is there in the input file with the same case.
To maintain the format use this
Code:
fold -w 150 filename | awk '/EA2/ { print $0 }'> tmp
tr -d '\n' tmp > /home/test/EA2.dat
Reply With Quote
  #5  
Old 02-05-2007
Registered User
 

Join Date: Jun 2006
Posts: 39
It works...I will check it out more and let you know if I face any problems.

Thanks a lot for your help!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:11 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0