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 the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 03-16-2008
McLan McLan is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 21
awk- report generation from input file

Thanks Klashxx
its Wonderful, it works.
I was trying to undersand what does FS="( )|(,)" do?
Could you please give more info on this, however without the above also the output is same
awk '/^Name/{n=$NF}/^Address/{a=$2}/^City/{print n,a,$NF}' inpfile
lastname1 111, Hilversum
lastname2 222, Bussum
lastname3 333, Amsterdam

now the request is different:
the input file is :
Person:
Name: Firstname1 lastname1
Address: 111, Street "Narder straat"
City : Hilversum

Person:
Name : Fistname2 lastname2
Address: 222, Street "Zoud straat"
City: Bussum

Person:
Name : Firstname2 lastname3
Address: 333, Street "Station straat"
City: Amsterdam


I need the outout file as below:
lastname1 111 "Narder straat" Hilversum
lastname2 222 "Zoud straat" Bussum
lastname3 333 "Station straat" Amsterdam

Thanks again