Formatting BAT Data

From NippAero

Jump to: navigation, search

I hate doing things by hand and pouring over CSV files and copy/pasting data is no exception.

Using Awk to create the phone display field from the csv data.

Example CSV File

test.csv
********
Issabel,Smith,ismith,Phone,Receptionist 7961,512-555-5000,001E135D1B34,89300,5125555000,DID
Mechelle,Smith,msmith,Phone,,512-378-9303,001DA29131D4,89303,51237XXXXX,DID 
Donna,Smith,dsmith,Phone,,512-378-9304,001DA2910105,89304,51237XXXXX,DID
Cheryl,Smith,csmith,Phone,,512-378-9305,001DA290D5F4,89305,51237XXXXX,DID


Use Awk to format the data

cat test.csv |awk -F"," '{print $1, $2, "-", $8}'

Example Output

Issabel Smith - 89300
Mechelle Smith - 89303
Donna Smith - 89304
Cheryl Smith - 89305
Personal tools