g.list.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <h2>DESCRIPTION</h2>
  2. <em>g.list</em> searches for data files matching a pattern given by
  3. wildcards or POSIX Extended Regular Expressions.
  4. <h2>NOTES</h2>
  5. The output of <em>g.list</em> may be useful for other programs' parameter
  6. input (e.g. time series for <em><a href="r.series.html">r.series</a></em>)
  7. when used with <em>separator=comma</em>.
  8. <h2>EXAMPLES</h2>
  9. List all raster maps as continuous, sorted list:
  10. <div class="code"><pre>
  11. g.list type=rast
  12. </pre></div>
  13. List all vector maps as continuous, sorted list with MAPSET info (i.e.
  14. fully-qualified map names):
  15. <div class="code"><pre>
  16. g.list type=vector -m
  17. </pre></div>
  18. List all raster and vector maps ordered by mapset:
  19. <div class="code"><pre>
  20. g.list type=raster -p
  21. </pre></div>
  22. List all raster and vector maps as continuous, sorted list:
  23. <div class="code"><pre>
  24. g.list type=rast,vect
  25. </pre></div>
  26. List all available GRASS data base files:
  27. <div class="code"><pre>
  28. g.list type=all
  29. </pre></div>
  30. <h3>Mapset search path</h3>
  31. If <b>mapset</b> is not specified, then <em>g.list</em> searches for
  32. data files in the mapsets that are included in the search path
  33. (defined by <em><a href="g.mapsets.html">g.mapsets</a></em>).
  34. See <tt>g.mapsets -p</tt>.
  35. <div class="code"><pre>
  36. g.list rast -p
  37. raster map(s) available in mapset &lt;user1&gt;:
  38. dmt
  39. ...
  40. raster map(s) available in mapset &lt;PERMANENT&gt;:
  41. aspect
  42. ...
  43. </pre></div>
  44. Option <b>mapset</b>=. (one dot) lists only data files from
  45. the current mapset:
  46. <div class="code"><pre>
  47. g.list rast mapset=.
  48. ...
  49. </pre></div>
  50. <!-- better quote * as "*"? -->
  51. Similarly, <b>mapset</b>=* (one asterisk) prints data files from all
  52. available mapsets also including those that are not listed in the
  53. current search path (see <tt>g.mapsets -l</tt>).
  54. <div class="code"><pre>
  55. g.list rast mapset=* -p
  56. raster map(s) available in mapset &lt;landsat&gt;:
  57. lsat5_1987_10
  58. ...
  59. raster map(s) available in mapset &lt;user1&gt;:
  60. dmt
  61. ...
  62. raster map(s) available in mapset &lt;PERMANENT&gt;:
  63. aspect
  64. ...
  65. </pre></div>
  66. <h3>Wildcards</h3>
  67. List all vector maps starting with letter "r":
  68. <div class="code"><pre>
  69. g.list type=vector pattern="r*"
  70. </pre></div>
  71. List all vector maps starting with letter "r" or "a":
  72. <div class="code"><pre>
  73. g.list type=vector pattern="[ra]*"
  74. </pre></div>
  75. List all raster maps starting with "soil_" or "landuse_":
  76. <div class="code"><pre>
  77. g.list type=raster pattern="{soil,landuse}_*"
  78. </pre></div>
  79. List certain raster maps with one variable character/number:
  80. <div class="code"><pre>
  81. g.list type=raster pattern="N45E00?.meters"
  82. </pre></div>
  83. Use of <b>exclude</b> parameter:
  84. <div class="code"><pre>
  85. # without exclude:
  86. g.list rast pat="r*" mapset=PERMANENT
  87. railroads
  88. roads
  89. rstrct.areas
  90. rushmore
  91. # exclude only complete word(s):
  92. g.list rast pat="r*" exclude=roads mapset=PERMANENT
  93. railroads
  94. rstrct.areas
  95. rushmore
  96. # exclude with wildcard:
  97. g.list rast pat="r*" exclude="*roads*" mapset=PERMANENT
  98. rstrct.areas
  99. rushmore
  100. </pre></div>
  101. <h3>Regular expressions</h3>
  102. List all soil maps starting with &quot;soils&quot; in their name:
  103. <div class="code"><pre>
  104. g.list -r type=raster pattern='^soils'
  105. </pre></div>
  106. List &quot;tmp&quot; if &quot;tmp&quot; raster map exists:
  107. <div class="code"><pre>
  108. g.list -r type=raster pattern='^tmp$'
  109. </pre></div>
  110. List &quot;tmp0&quot; ...&quot;tmp9&quot; if corresponding vector map exists
  111. (each map name linewise):
  112. <div class="code"><pre>
  113. g.list -r type=vector pattern='^tmp[0-9]$'
  114. </pre></div>
  115. List &quot;tmp0&quot;...&quot;tmp9&quot; if corresponding vector map exists
  116. (each map name comma separated):
  117. <div class="code"><pre>
  118. g.list -r type=vector separator=comma pattern='^tmp[0-9]$'
  119. </pre></div>
  120. <h3>Extended regular expressions</h3>
  121. List all precipitation maps for the years 1997-2012, comma separated:
  122. <div class="code"><pre>
  123. g.list -e type=raster separator=comma pattern="precip_total.(199[7-9]|200[0-9]|201[0-2]).sum"
  124. </pre></div>
  125. <h3>Maps whose region overlaps with a saved region</h3>
  126. List all raster maps starting with &quot;tmp_&quot; whose region overlaps with
  127. the region of &quot;test&quot; raster map:
  128. <div class="code"><pre>
  129. g.region raster=test save=test_region
  130. g.list type=raster pattern='tmp_*' region=test_region
  131. </pre></div>
  132. List &quot;tmp0&quot;...&quot;tmp9&quot; vector maps whose region overlaps with
  133. the current region:
  134. <div class="code"><pre>
  135. g.list -r type=vector pattern='^tmp[0-9]$' region=.
  136. </pre></div>
  137. List all raster and vector maps whose region overlaps with the default region
  138. of the PERMANENT mapset in the current location (DEFAULT_WIND):
  139. <div class="code"><pre>
  140. g.list type=rast,vect region=*
  141. </pre></div>
  142. Note that, without <tt>region=*</tt>, <tt>g.list type=rast,vect</tt> simply
  143. lists all available raster and vector maps from the current search path
  144. regardless of their region.
  145. <h2>SEE ALSO</h2>
  146. <em>
  147. <a href="r.series.html">r.series</a>,
  148. <a href="t.list.html">t.list</a>,
  149. <a href="t.rast.list.html">t.rast.list</a>,
  150. <a href="t.vect.list.html">t.vect.list</a>
  151. </em>
  152. <p>
  153. <a href="http://en.wikipedia.org/wiki/Regular_expression">Regular expressions</a>
  154. (aka regex) - from Wikipedia, the free encyclopedia
  155. <h2>AUTHOR</h2>
  156. Huidae Cho<br>
  157. grass4u@gmail.com
  158. <br>
  159. based on general/manage/cmd/list.c by Michael Shapiro