AWK delete issue


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting AWK delete issue
# 1  
Old 11-16-2011
AWK delete issue

Hi,

Does "delete array_name[x]" actually return back free memory to the system? I am having trouble when processing big files. If it doesnot return memory is there any other command to do so? Smilie

Thanks guys..!!

---------- Post updated at 03:20 PM ---------- Previous update was at 02:43 PM ----------

another interesting that I observed was when cing the memory footprint using top, awk seems to be using only .1% of the memory but the overall memory decreases in due course as my program runs. I have no other application running.

Any reason for this strange behavior??

---------- Post updated at 03:20 PM ---------- Previous update was at 03:20 PM ----------

another interesting that I observed was when cing the memory footprint using top, awk seems to be using only .1% of the memory but the overall memory decreases in due course as my program runs. I have no other application running.

Any reason for this strange behavior??
# 2  
Old 11-16-2011
Quote:
Originally Posted by jamie_123
Hi,

Does "delete array_name[x]" actually return back free memory to the system?
No it doesnt return memory back to the os...that happens only when the process exits.
Quote:
Originally Posted by jamie_123
I am having trouble when processing big files. If it doesnot return memory is there any other command to do so? Smilie

Thanks guys..!!
That command is called "exit"...
Quote:
Originally Posted by jamie_123
another interesting that I observed was when cing the memory footprint using top, awk seems to be using only .1% of the memory but the overall memory decreases in due course as my program runs. I have no other application running.

Any reason for this strange behavior??
That does seem strange...can you use sar to verify that awk is only using 0.1% of the memory.
# 3  
Old 11-16-2011
Quote:
Originally Posted by jamie_123
another interesting that I observed was when cing the memory footprint using top, awk seems to be using only .1% of the memory but the overall memory decreases in due course as my program runs. I have no other application running.

Any reason for this strange behavior??
We are not "on call" here. If someone doesn't instantly answer your post, wait! Smilie

By what metric are you measuring unused memory? "free"?

Quote:
Originally Posted by Corona688
You are having the standard linux newbie memory freakout. We sometimes see a few of these a month. Take a deep breath and relax -- you're not running out of memory.

Memory that's otherwise sitting idle gets used for caches when there's anything to cache, because it's wasted just sitting around doing nothing. The kernel gives it up just as readily as any other unused memory -- you don't need to "free" anything or put your computer through weird convolutions to "release the cache". Everything is fine.

Just consider 'cache' and 'free' to get truer numbers on how much memory is available.
Processing big files is exactly the sort of situation which would convert all available 'free' into 'cache' memory. This is fine.
# 4  
Old 11-17-2011
Hi,

Thanks to the both of you. I have no clue why the same post was made twice earlier..didnt mean it.

The issue that I had was solved by changing the syntax of print statement. I was using printf "%s\n", "blah blah: " $0; when I changed it to print $0 it worked fine. Have no clue why, but it works now without crashing mid way. Can anyone point me at the mistake here?

Thanks again!

I have a file now with two columns, the first one having epoch times. I am interested in extracting hourly times from this whole table. I tried something like this- awk '/1319130869/, $NF ~ /1319130870/ '. It works when the time that I am extracting is at the end of the file. when doing the same for values at the begining it returns me all the values. Should I try something else to do this? or is something like sed a better option here?
Please help me out.
Thanks in advance!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete big directory issue

Hello folks, I am deleting a directory with script it is taking 11Hour and also increase the IO on server. I am using below command, inside date directory there are hour directories, which i am deleting after archiving. Archiving is not taking long time, only "rm -rf" is taking alot of time with... (21 Replies)
Discussion started by: learnbash
21 Replies

2. Shell Programming and Scripting

Variable value substitution issue with awk command issue

Hi All, I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command. The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies

3. UNIX for Dummies Questions & Answers

Using awk to delete a certain line

Ok I have a file that contains #num.txt 1 2 3 4 5 6 7 8 9 my script main.sh checks to see if the first two arguments exist in a seperate file and the third argument would be the value in the num.txt so when i execute $ main.sh name place 5 how would i go about deleteing the... (13 Replies)
Discussion started by: austing5
13 Replies

4. Shell Programming and Scripting

Delete certain column awk

Hi experts, I have a file, where inside this file contains multiple columns (up to 2000 columns): 0.05 0.54 2.02 0.21 1.39 2.92 0.31 1.75 3.34 I want to delete column 3,6,9,12,15,18,21... etc (any columns where can be divided from value 3), so that results is like: 0.05 0.54 0.21 1.39... (6 Replies)
Discussion started by: guns
6 Replies

5. Shell Programming and Scripting

Delete text between square brackets and also delete those square brackets using sed or awk

Hi All, I have a text file which looks like this: computer programming systems engineering I want to get rid of these square brackets and also the text that is inside these brackets. So that my final text file looks like this: computer programming systems engineering I am using... (3 Replies)
Discussion started by: shoaibjameel123
3 Replies

6. Shell Programming and Scripting

delete string using AWK

inputfile has 3 columns SCHEMA.TAB1 COL1 LENGTH SCHEMA.TAB2 COL2 LENGTH. If i use awk on the above inputfile awk '{print $1}' inputfile.The out put will be SCHEMA.TAB1 SCHEMA.TAB2. But from the above output i need to delete SCHEMA. i.e i don't want the string "SCHEMA." should... (6 Replies)
Discussion started by: rocking77
6 Replies

7. Shell Programming and Scripting

how to delete line with awk

Hi I have a multi -line file which is sorted by the 1-st colomn in the following format: 400 0000 0001 1000 1010 0111 0000 1000 0000 402 1101 0000 1100 1010 0111 1000 1000 0000 403 1001 0000 1100 1010 0111 0000 1000 0000 495 1000 0000 1100 1010 0111 0000 1000 0000 500 0000 0001 1000 0010... (2 Replies)
Discussion started by: aoussenko
2 Replies

8. Shell Programming and Scripting

awk - delete last two letters

Hello! How do I remove the last two letters "GB" off each line, using awk? What I need to remove is the "GB" in following input: ..... 30GB 2504GB 3GB 40GB ...... The OS used is Solaris9 Regards, Fredrik (1 Reply)
Discussion started by: sap4ever
1 Replies

9. UNIX for Dummies Questions & Answers

delete files using awk

The code below works for finding files created in 2005 that are compressed. How do I delete these files? Do I substitute rm -f for the print $0 ? here's the code that finds the 2005 compressed files (ls -lR | awk '$8 == "2005" && $9 ~ /Z$/ {print $0}') thanks for your help!!! (2 Replies)
Discussion started by: igidttam
2 Replies

10. Shell Programming and Scripting

awk : delete ^M at the end of the line

Hi all, I'm newbi in scripting. could someone tell how to delete the ^M at the end of the linie with an awk command. many thanks in advance. (2 Replies)
Discussion started by: liliput
2 Replies
Login or Register to Ask a Question