Jan 27, 2012

Ngakalin SOBEK asc file untuk input ke Grass GIS


Problem:
Nggak bisa mbuka asc file hasil model SOBEK either make ArcGIS atau pun Grass GIS.
Ternyata:
File asc ada 'comment' di baris 1. Baris ini, kata yg ngerunning model harus dihapus dulu.
Problem baru:
File-nya ada ratusan. Rasakno ...

Solusi: sed (atau tail)
Perangkatnya Linux atau Cygwin (karena di kampus ga dikasih Linux) yg didalamnya ada sed.
Plus sedikit skill regex yang bisa didownload langsung dari sini:
  1. http://ubuntuforums.org/showthread.php?t=395658
  2. http://sed.sourceforge.net/grabbag/tutorials/do_it_with_sed.txt
  3. http://www.unix.com/unix-dummies-questions-answers/4056-sed-across-multiple-files.html
  4. http://www.tutorialspoint.com/unix/unix-regular-expressions.htm

Gampang, kan?

Nanti ketemu lagi, insya Allah.

1 comment:

  1. # sed pipe to filename
    # http://www.unix.com/unix-dummies-questions-answers/4056-sed-across-multiple-files.html

    for x in `cat ascfiles`
    do
    sed 1d $x > temp
    cat temp > $x
    rm temp
    done

    ReplyDelete