[GRASS-user] module output redirection to file

Jannis Achstetter krippi at gmail.com
Wed Aug 8 12:35:57 EDT 2007


M S schrieb:
> If i do something like this in the grass terminal:
> g.version > version
>
> i get the grass version in a text file.  However, I would like to
> capture the output from r.lake into a text file and grab the lake
> geometry parameters.  Is there a reason this would not put the
> terminal output into a file?  I get an empty output file, and the
> module output still goes to the terminal.
>
> r.lake dem=surface wl=37 lake=lake37 seed=seedMap > lakeFile
>
> as icing on the cake, it would be nice to only grab the lines with the
> word "Lake" with grep.
> r.lake dem=surface wl=37 lake=lake37 seed=seedMap | grep Lake >
> lake37File
>
> Something simple perhaps I am overlooking?

I think, this has nothing to do with overclocking ;)
It will most likely be that the module puts it's stuff to stderr rather
than to stdout. With "> file" you redirect stdout to a file but stderr
will still be printed to your terminal.
I you want stderr in a file and stdout on the console, use "2> file", if
you want both stdout and stderr in the file (and nothing on your
console), use "&> file".

More about this topic can be found at:
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html

Regards,
    Jannis Achstetter




More information about the grass-user mailing list