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 -->
  #3 (permalink)  
Old 08-07-2007
Klashxx's Avatar
Klashxx Klashxx is offline
HP-UX/Linux/Oracle
 

Join Date: Feb 2006
Location: Almerķa, Spain
Posts: 383
To start:
Code:
pattern=$1
rep_string=$2
awk -F\~ -v pat=${pattern} -v rep=${rep_string} 'BEGIN{OFS=FS}{if ( $4 == pat){sub(/'"${pattern}"'/,rep,$4)}print}' txt

Last edited by Klashxx; 08-07-2007 at 01:59 AM..
Reply With Quote