Hi,
How can I get the value for Name and City for both records? Both records start with From: and end with [End Order]. There are blank lines between each field within a record. However, each record does not have the same number of fields (like first record does not have any City field and second record does). Therefore, I don't want to hard-code their positions ($1, $2, etc).
I was trying the following to get value for Name:
awk '{ print $2 }' RS="[End Order]" Sample.txt
Please help!
Thanks.
-Parul
parani19@hotmail.com
I have the following records in Sample.txt:
From:
Name: aaa
Street: bbb
[End Order]
From:
Name: ddd
Street: eee
City: fff
[End Order]