Hello I found a solution based on the first suggestions using sed unix shell skript
I post it here so someone has to solve a similar task may find it helpful
#/bin/bash

cd /media/My\ Book/zamg/Lieferung_23052011/

#cd ~/Desktop/test

filelist=`find . -name '*asc'`

for file in $filelist; do
    echo $file
    sed -f ~/Desktop/test/asc.sed $file > temp.asc
    cp temp.asc $file
done

rm temp.asc

best regards
alex

MSc. Alexander Arpaci
Assistant researcher

Department of Forest - and Soil Sciences
Institute of Silviculture
Tel. +43-1-47654-4081
e-mail: alexander.arpaci@boku.ac.at
www.wabo.boku.ac.at 
>>> Robert Hijmans  22.06.11 18.21 Uhr >>>
> have a large number (several thousand) of asci files which were 
> delivered to me without a NODATA_value  -999.0 line in the header 


If all your files are for the same area you could do something like

r <- raster(ncol=601, nrow=351, xmn=100000, xmx=701000, ymax=250000, 
ymn=-101000)

filename <- 'file.asc'
v <- as.numeric( scan(filename, skip=6, what='character') 
v[v==-999] <- NA
r1 <- setValues(r, v)

Else you could read the first couple of lines to adjust values in the
'raster' function. 

Robert


--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/insert-NODATA-value-999-0-into-asc-file-tp6497397p6504947.html
Sent from the R-sig-geo mailing list archive at Nabble.com.

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


	[[alternative HTML version deleted]]

