Wednesday, May 23, 2012

Some Useful Line Command Snippets

1. To Import data from a CSV file delimited with ',' into postgresql database, use the following command line:

cat population.csv | psql -U postgres -d geodata -c "COPY public.population(pop_adm0_name, pop_size) FROM STDIN WITH CSV HEADER;"

2. Filter fields from a JSON response resource:
curl --silent "https://maps.googleapis.com/maps/api/place/search/json?sensor=false&key=$GOOGLE_KEY&location=-16.493698,-68.134267&radius=300" | egrep \(name\|types\) | more # types

Others, coming soon...

No comments: