The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 05-02-2008
ripat ripat is offline
Registered User
 

Join Date: Oct 2006
Location: Belgium
Posts: 171
Put this code in a file.

File: my-awk
Code:
BEGIN {
    RS="\n\$\n"
    FS="\n"
    ORS="\n$\n"
}


/£/ {
    sub(/sweet /, "", $1)
    sub(/£.+/, "£", $1)
    print $1
}

!/£/ {
    print $0
}
Code:
$ awk -f my-awk your-file-to-process
Reply With Quote