LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   record buffer provided by awk (https://www.linuxquestions.org/questions/linux-newbie-8/record-buffer-provided-by-awk-4175534481/)

Upendra Pratap Singh 02-18-2015 10:23 PM

record buffer provided by awk
 
we do have a record buffer in awk utility that holds one complete record of a data file.

I want to know that if record buffer changes during script processing, then when are these changes reflected back to the data file?

Are they reflected immediately or is there an in-built mechanism available to schedule this change?

grail 02-18-2015 11:49 PM

awk by default does not alter the original file at all, even though you may alter the data in certain variables.

If this is not the answer you were after, please explain further what you mean?

Upendra Pratap Singh 02-19-2015 12:46 AM

Quote:

even though you may alter the data in certain variables.
are these the system variables (like NR, FNR) that you are talking about or the the field values stored in the data files?

grail 02-19-2015 08:01 AM

Yes you can alter NR and FNR (although they are 2 you would generally not alter as it will obscure your results), but more like FS, OFS, RS, ORS and the like.


All times are GMT -5. The time now is 01:29 AM.