LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-18-2015, 10:23 PM   #1
Upendra Pratap Singh
Member
 
Registered: May 2011
Location: India
Distribution: Ubuntu 14.04
Posts: 110
Blog Entries: 4

Rep: Reputation: 0
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?
 
Old 02-18-2015, 11:49 PM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,006

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
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?
 
Old 02-19-2015, 12:46 AM   #3
Upendra Pratap Singh
Member
 
Registered: May 2011
Location: India
Distribution: Ubuntu 14.04
Posts: 110

Original Poster
Blog Entries: 4

Rep: Reputation: 0
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?
 
Old 02-19-2015, 08:01 AM   #4
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,006

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] clamd libClamAV Error: cli_dbgets: Line too long for provided buffer [GOD]Anck Debian 1 09-28-2010 02:17 AM
awk: How can I keep the format of the record? quanba Programming 5 04-05-2010 09:50 PM
Is this possible to record inputs which will be provided during running script gangadhar_m Linux - Server 10 02-23-2010 03:10 AM
awk record separator question johnpaulodonnell Linux - Newbie 2 07-30-2007 09:35 AM
awk: How can I return a specified record dimsh Linux - Newbie 4 09-24-2005 11:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration