The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 06-22-2007
aigles's Avatar
aigles aigles is offline
Registered User
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,212
Quote:
Originally Posted by ghostdog74 View Post
Code:
awk 'BEGIN{FS="";OFS=""}
     $21~"G" && $22 ~ "H"{ $21="K";}
	 {print }
' "file1"
This solution doesn't work with my version of awk under AIX. With an empty Input File Separator, the field 1 contains the whole record :
Code:
$ awk 'BEGIN{FS="";OFS=""}
>      { printf("$0=<%s>\n$1=<%s>\n", $0, $1) }
> ' rep.txt
$0=<D1254215221542 MANA3DS2OOR454>
$1=<D1254215221542 MANA3DS2OOR454>
$0=<C1254815221121 MDGA4GH4OOR454>
$1=<C1254815221121 MDGA4GH4OOR454>
$0=<A1254215221522 AFFA4DF4OODS54>
$1=<A1254215221522 AFFA4DF4OODS54>
$0=<S3454815221121 TDTA4GH465R454>
$1=<S3454815221121 TDTA4GH465R454>
$
Reply With Quote