bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk] How to change Field without changing OFS


From: Barco You
Subject: [gawk] How to change Field without changing OFS
Date: Fri, 13 Feb 2009 16:47:31 +0800

Hi all,

I'm writing a program like following attached, for processing some file
including strings like
"DBTSC:NAME=CCSEXCHANGE,SETNAME=CCSS;"
....
when I change some filed, and then redirect the record to new file, the
fields will be separated by spaces. like:
"DBTSC NAME CCSEXCHANGE SETNAME 1"

My problem is: how can I keep the records in original formats with some
field's value changed.
Please help me, thanks!


#!/bin/awk -f
BEGIN{
    FS="[:=,;]"
}
########################################
/dbtsc|DBTSC/&&/CCSEXCHANGE/&&/CCSS/ {
    $FN = 1
    print >FILENAME
    next
}
########################################
{
    print >FILENAME
}


-- 
-------------------------------
Enjoy life!
Barco You


reply via email to

[Prev in Thread] Current Thread [Next in Thread]