oostopitre
4/24/2014 - 8:15 PM

Cube Script Samples

Cube Script Samples

Delete existing gdb file if present

**DEL /f /s /q "{SCENARIO_DIR}\{SCENARIO_SHORTNAME}_Cube.gdb"

Copy empty gdb to scenario directory to store gis network

**XCOPY "{CATALOG_DIR}\Application\EmptyCube.gdb" "{SCENARIO_DIR}\{SCENARIO_SHORTNAME}_Cube.gdb" /Y /E /I

Cut the first 6 fields from a csv:

cut -d, -f1-6

Number of Fields in a CSV File:

awk -F',' '{print NF }' top500_1.csv |sort |uniq -c

Number of Lines in a CSV File:

wc -l top500_1.csv

Extract the first 2 lines and 4th line from a csv file:

sed -n 1,2p -e 4p top500_1.csv

DIR Human readable:

ls -lh

wget a file:

wget 'http://ftp2.census.gov/acs2012_5yr/pums/csv_hil.zip'

combine two csv files (horizontally):

cat ak_od_main_JT01_2011.csv > LODES_National.csv
cat al_od_main_JT01_2011.csv | sed "1 d" >> LODES_National.csv

Find the Projection System of table in PostGIS:

SELECT Find_SRID('public', '3_1_streets', 'geom');

Import a shapefile into PostGIS:

shp2pgsql -I -s 4326 -W "latin1" "L:\st_w_name_st.shp" "__st_w_name_st" | psql -q -h gimli -U postgres -d esri_national_db

Call R from Voyager:

# In PILOT 
**"C:\Program Files\R\R-3.1.0\bin\Rscript.exe" "C:\loc_of_R_File\test.R"


#In test. R
setwd("C:\\projects\\1_transfer_counts\\Base")
test <- head(iris)
write.csv(test, "iris.csv")