🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Alan Yeung Fri, 09 May 1997 00:00
Changing fields
#3882
Author: Alan Yeung
Date: Fri, 09 May 1997 00:00
14 lines
410 bytes
hi all,
i'm an awk newbie, and i was looking at the man page of awk on an AIX
machine.
it says that "selected portions of the input file can be altered", but
doesn't say how. so i surfed the net hoping to find out how. but it
seems that most of the implementions do not allow alteration of the
original input, so i'm comfused as to whether input can be altered at
all.
any hints are appreciated. thanx!

al


Re: Changing fields
#3900
Author: ptjm@ican.net (P
Date: Mon, 12 May 1997 00:00
25 lines
630 bytes
In article <33738DA5.4DAB@sasktel.sk.ca>,
Alan Yeung  <alan.yeung@sasktel.sk.ca> wrote:

% i'm an awk newbie, and i was looking at the man page of awk on an AIX
% machine.
% it says that "selected portions of the input file can be altered",

awk can't be used to edit a file in place.  If you need to do that,
consider using ed, or else redirect the awk output to a temp file and
rename the temp file.  For instance, you can do something like this:
  BEGIN { ARGC = 2; ARGV[1] = "a.b" }
  { print $3,$2,$1 > "b.a" }
  END {
	  system("rm a.b")
	  system("mv b.a a.b")
  }
--

Patrick TJ McPhee
East York  Canada
ptjm@ican.net



Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads