nouse66
04-25-2004, 03:30 PM
i have a huge data set i'd like to reformat and i think awk can do it but i dont know the language very well.
the data is in this pattern:
1. name
type of business
address
city, state zip
phone number
2. name
type of business
address
city, state zip
phone number
3. name
type of business
address
city, state zip
phone number
and i'd like to turn it into this:
name, type of business, address, city, state, zip, phone number
name, type of business, address, city, state, zip, phone number
etc...
i wrote this awk script but it's not coming out right...
BEGIN { RS = "" ; FS = "\n"}
{
print $1 ", " $2 ", " $3 ", " $4 ", " $5
}
all i get in return when running awk -f on the file is the first record. it's formatted how i'd expect though (state and zip are still one field of course). are the double linebreaks inbetween records messing it up?
can awk do replacement with regexes or will have hae to do some other processing in another language?
the data is in this pattern:
1. name
type of business
address
city, state zip
phone number
2. name
type of business
address
city, state zip
phone number
3. name
type of business
address
city, state zip
phone number
and i'd like to turn it into this:
name, type of business, address, city, state, zip, phone number
name, type of business, address, city, state, zip, phone number
etc...
i wrote this awk script but it's not coming out right...
BEGIN { RS = "" ; FS = "\n"}
{
print $1 ", " $2 ", " $3 ", " $4 ", " $5
}
all i get in return when running awk -f on the file is the first record. it's formatted how i'd expect though (state and zip are still one field of course). are the double linebreaks inbetween records messing it up?
can awk do replacement with regexes or will have hae to do some other processing in another language?