Tag Archives: shell

linux shell获取当前文件的时间

主要的目的是想用文件的创建时间给文件重新命令。这在从数码相机中导入录像的时候有用。 stat geoserver-1.6.5-bin.zip | grep Modify | awk ‘{print $2 $3}’ | cut -d”.” -f1 | sed -e ‘s/-//g’ -e ‘s/://g’ 或者: stat -c %y geoserver-1.6.5-bin.zip | awk ‘{print $1 $2 $3}’ | cut -d”.” -f1 | sed -e ‘s/-//g’ … Continue reading

Posted in Linux | Tagged , , , | 1 Comment

批量重命名gzip包内文件

应wu要求,转换一个gz文件里的文件名称为gz文件名,而且gz包只有一个文件,其实就是解压缩,然后再压缩。 for i in *.gz;do gzip -d $i && gzip ${i%.gz};done

Posted in Linux | Tagged , , | Leave a comment

用shell脚本导入landuse数据到postgis

全国的土地利用数据,80年代末,1995和2000年3期数据,ARCINFO COVERAGE格式,打算直接转入POSTGIS库中。 写了一个shell文件,花费了2天时间。主要是shell的东西是边看边写的,特别是变量处理,还真是麻烦。 运行shell文件要先进入到landuse目录,postgis里应该已经有westdc库,并且已经 进行了POSTGIS初始化,导入过landuse表,并且已经增加了areacode和year字段,不能为NULL,且默认为空值。 从avcbin格式到postgis库,因为数据表的关系,作了两次转换。提出了ARCINFO中的cov#和cov-id字段。 #!/bin/sh # cd /opt/to_reback/data/landuse tmpdata=./tmpdata YEAR=”80年代末 1995年 2000年” for a in $YEAR; do for b in $a/*; do #province, 目录判断 if [ -d $b ]; then rm -fdr $tmpdata for c in $b/ld*; do … Continue reading

Posted in Linux, PostGIS | Tagged , , | 4 Comments

gdal.sh自动更新安装

为了gdal更新的方便,写了一个简单的shell脚本: cd /root/gdal/ cvs update ./configure –with-hdf4 –with-netcdf –with-pg=/usr/local/pgsql/bin/pg_config –with-geos –with-libtiff=internal –with-static-proj4 –with-grass=/usr/local/grass-5.7.cvs make clean make make install

Posted in Computer, GIS, RS | Tagged , , , | Leave a comment