[GRASSLIST:4666] Re: big ASCII

Gordon Keith gordon.keith at csiro.au
Sun Oct 6 22:57:08 EDT 2002


On Sun, 6 Oct 2002 10:29, Roger Miller wrote:
> I also use StarOffice Calc for editing large files - some
> considerably larger than 8 mb.  StarOffice usually opens any variety
> of text file in a word processor.  To open a text file in a
> spreadsheet in Star Office 5.2 you must select the option
> <Text-txt-csv (StarOffice Calc)> in the file open dialog box.  If you
> select any other form of text file you get a word processor document.
>   StarOffice Calc can also write text files.

This is also true of OpenOffice.org and StarOffice 6.0.

I find a very small amount of awk knowledge extremely useful in 
reformatting large ascii files.

For example to convert from y,x,depth to x y height (suitable for 
s.in.ascii) I use the following:

gawk -F, '{ printf "%f %f %f\n", $2 , $1 , -$3 }' in.ascii > out.ascii

-F, means use comma as field delimiter, default is white space.
$n is the n'th field ($1 the first field, $0 the whole line).
The command(s) must be in { } (separated by semicolon).
The whole awk program should be enclosed in ' ' so that the shell 
doesn't muck about with the $ and " symbols.

awk is quite powerful, read the man page for details, but the above may 
be all you need for a simple reformatting task.

Hope this helps.
Gordon

-- 

Gordon Keith
Programmer/Data Analyst
Marine Acoustics
CSIRO Marine Research
http://www.marine.csiro.au

Now the message we have heard from his Son and announce is this:
God is light, and there is no darkness at all in him."
  -- 1 John 1:5



More information about the grass-user mailing list