On 08/11/2010 03:10 PM, Hanlie Pretorius wrote:
My apologies for my ignorance, but how do I get this to run in Linux?
Am using Ubuntu 10.04 and GRASS 6.4RC6.
Samber's method will surely work, but you might more simply try as follows:
# start grass in a location which matches the txt file data
# change to the directory where your txt files are, then do
for infile in *.txt; do outrast=`basename ${infile} .txt`; r.in.xyz
in=${infile} out=${outrast} fs=,; done
# that's it ;-)
--
Micha
I entered the following into the GRASS text window and am testing it
with a list of two files (I removed the region settings because the
files all have the same region, which I have already set):
-----
GRASS 6.4.0RC6 (world_wgs84):~> cat lieb_files_test.txt
3B42.000201.12.6.nc.lieb.txt
3B42.000201.15.6.nc.lieb.txt
GRASS 6.4.0RC6 (world_wgs84):~> cat lieb_files_test.txt | while read line; do
echo $line+" being processed"
raster=${$line:(-12)} # cut ".nc.lieb.txt" from raster name
r.in.xyz --overwrite input=$line output=raster method="mean" type="FCELL" fs=,
x=2 y=1 z=3
-----
As you can see, when I press enter after the r.in.xyz line, I just get
another prompt.
Am I supposed to save it to a separate file and run this as a script?
If so, where should I put this script?
2010/8/10, Saber Razmjooei<razmjoo...@faunalia.co.uk>:
cat list_of_files.txt | while read line; do
echo $line+"Being processed" # or whaterver you want to do with the
$line variable
raster=$line
r.in.xyz -s -g input=$line output=$line> tmpRegion
myregion= ""`head -n 1 tmpRegion`"
g.region $myregion
r.in.xyz --overwrite input=$line output=$line fs=,
done
and your list_of_files.txt is
raster1
raster2
.....
Hope that helps
Saber
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user
This mail was received via Mail-SeCure System.
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user