AWK Memory Limit ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting AWK Memory Limit ?
# 1  
Old 06-27-2010
AWK Memory Limit ?

Is there an input file memory limit for awk?

I have a 38Mb text file that I am trying to print out certatin lines and add a string to the end of that line.

When I excute the script on the 38Mb file the string I am adding is put on a new line. If I do the same with a smaller file the string is put on to the end of the line like I requested.

Any suggestions on how to address this issue?

The code excerpt is below;

Code:
if(NR == spcline+1 && FNR != 1 && $0 !~ /101106/) {printf "%1$s%2$s\n", $0 , "  101106"}

Thanks

---------- Post updated at 07:21 PM ---------- Previous update was at 04:35 PM ----------

I figured this out. It has nothing to do with memory

The problem is the new line character "\n" in the printf statement. If I remove it then the string remains on the same line.

Any one know how to print out newline characters in a file?
# 2  
Old 06-27-2010
Quote:
Originally Posted by cold_Que
Is there an input file memory limit for awk?

I have a 38Mb text file that I am trying to print out certatin lines and add a string to the end of that line.

When I excute the script on the 38Mb file the string I am adding is put on a new line. If I do the same with a smaller file the string is put on to the end of the line like I requested.

Any suggestions on how to address this issue?

The code excerpt is below;

Code:
if(NR == spcline+1 && FNR != 1 && $0 !~ /101106/) {printf "%1$s%2$s\n", $0 , "  101106"}

Thanks

---------- Post updated at 07:21 PM ---------- Previous update was at 04:35 PM ----------

I figured this out. It has nothing to do with memory

The problem is the new line character "\n" in the printf statement. If I remove it then the string remains on the same line.

Any one know how to print out newline characters in a file?
You just answered your own question - '\n' is your friend.
# 3  
Old 06-27-2010
What do you mean - print out newline characters in a file?
# 4  
Old 06-28-2010
jim mcnamara,

I mean the ability to see no printing characters ie..... if i run

$ cat -v file.txt

This will print carriage returns.

Is there away to see other non-printing characters?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Cpu, memory - limit by user

Hi all ! I'm new in this site, so sorry if this question is into wrong place. How can I limit cpu/core and memory usage by user? System: RedHat Ent. Linux. 6.4 Tks, (4 Replies)
Discussion started by: Tiago
4 Replies

2. Red Hat

PAE kernel memory limit

What is the limit of LowMem and HighMem in PAE enable kernel. (2 Replies)
Discussion started by: hiten.r.chauhan
2 Replies

3. UNIX for Dummies Questions & Answers

character limit via awk

I'm using a command that outputs the total size of the files that I've specified. I'd like to introduce a character limit that appends an ellipsis to the lines that go beyond the specified amount. du -chs {query} | sed 's!.*/!!' | awk '{print substr($0,0,25)""}' That's what I have so far.... (4 Replies)
Discussion started by: Light_
4 Replies

4. AIX

Memory limit for C program

Greetings - I'm porting a C application to an AIX (6.1) system, and have bumped into the limits AIX imposes on memory allocation, namely the default limit of 256MB for a process. I'm aware of the compilation flag that allows an application to gain access to up to 8 memory segments (each 256MB,... (4 Replies)
Discussion started by: traviswheeler
4 Replies

5. Shell Programming and Scripting

Memory limit on php in .sh script

Hi, I have .sh script running php script with "php". When I run php script from web browser, it is running without errors. When I run it from .sh script, I am getting "memory exhausted". It seems to me that running php from .sh does not respect php.ini or have its own setting. So, how can I set... (0 Replies)
Discussion started by: LukasB
0 Replies

6. Shell Programming and Scripting

Problem with awk awk: program limit exceeded: sprintf buffer size=1020

Hi I have many problems with a script. I have a script that formats a text file but always prints the same error when i try to execute it The code is that: { if (NF==17){ print $0 }else{ fields=NF; all=$0; while... (2 Replies)
Discussion started by: fate
2 Replies

7. Shell Programming and Scripting

Limit output in awk

Hi All, I want to delimit the output using awk. For eg:: a,b,c,d,e,f abc,def,ghi should change to a|b|c|d|e|f abc|def|ghi Or to put in another way.. OFS will work in the following code if I seperate the values with comma (eg. $1,$2,$3,$4,$5,$6 ). But since the no. of... (3 Replies)
Discussion started by: PRKS
3 Replies

8. Shell Programming and Scripting

awk file size limit

My code is awk '{ out=split(FILENAME,a,"/") sub(/\./,"_",a) sub(/\-/,"_",a) NEWSTRING="main_"a"_"a"(" # The word we want to insert gsub(/main\(/,NEWSTRING); # the word to be replaced print "Main becomes ",NEWSTRING")","in file ",FILENAME >> "/home/ds2/test/NEW2.txt" ... (4 Replies)
Discussion started by: senior_ahmed
4 Replies

9. Ubuntu

Redhat 2.1 AS Memory Limit?

I have a customer with an HP DL380 G4 server running Redhat 2.1 AS that has 4GB memory installed. They want to upgrade in the server to the maximum of 12GB using (6) 2GB DIMMs. I can do this for them, but I read somewhere that Redhat 2.1 has an upper memory limit. Or you need a kernel patch to use... (2 Replies)
Discussion started by: Cbish68
2 Replies

10. UNIX for Dummies Questions & Answers

upper limit of accessible memory space for a single process in Unix/Linux

Hellp all, if there is 3G memory in my Unix server I want to know if all the 3G space can be used by ong sigle process. As i know, in Windows, one process can only access at most 1G memory despite there is probably more than 1G memory is equipped. (1 Reply)
Discussion started by: cy163
1 Replies
Login or Register to Ask a Question