How to 'update' a record

From: Liang, Warren <warren.liang_at_marconi.com>
Date: Mon, 28 Jan 2002 15:25:29 -0800

Hello:

While reading records from a data file mytest.txt, I like to 'update' the
last record read with another string. I try not to create a new file.
 
Here is my procedure:
#!/bin/ksh
exec 3< mytext.txt
while read -r -u3 rec1
do
        if [[ $rec1 = "obsolete" ]]
        then
                # update this record by replacing it with a string
"brandnew".
                # ?
        fi
done
exec 3<&- #close mytext.txt

Thanks in advance.

O/S: DEC Tru64 UNIX V5.0
Shell: Korn shell

Warren.
Received on Mon Jan 28 2002 - 23:31:59 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:43 NZDT