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;
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?
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;
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.
What do you mean - print out newline characters in a file?
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?