[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: H*e*l*p Needed




Remember FITS files are NOT text files, they are fixed
lenght record files, card images.  So if you take out four
characters you need to replace __exactly__ four characters.

There are programs that exist to do exactly what you want,
mass edits of FITS headers and are sophisticated enough to
do thinks like add 6 to every CRVAL1 if it is less than 8
and not mess up the 80 byte recrds in the process.  

OK, still you can use Perl.  What you need is a better
"patern"  perl -p -i -e 's/<pattern>/goo/g'

You are going to have to provide examples if someone is to
help you make a pattern that will fit all the bad lines and
nothing else.

the patterns are called "regular expressions" and they are
quite powerful.  You can read about how to make them at

  man perlre

Still I'd go get a copy of "hedit" or the like and use a
"real" FITS editor then has built-in controls to not let you
make an in-valid FITS file.


--- Tom Droege <tdroege2@earthlink.net> wrote:
> I keep forgetting that the server won't let you use certain words in
> the 
> subject line.  I don't see why.  It is a pain.
> 
> I have a bunch of data where I wrote the wrong values into CRVAL1 and
> 
> CRVAL2.  I need to do a global edit on the files.
> 
> OK, I have learned some things about perl and shell scripts.  So I
> can 
> march the files through a process.
> 
> Last time I needed to do this,        perl -p -i -e 's/foo/goo/g' 
> *.fits     did the job.  This is because I needed to change one
> specific 
> thing to another specific thing.  Now I need to change CRVALs which
> may 
> have any value to a specific value.  OK this is no doubt 1st grade
> perl but 
> I am still in kindergarten.  Someone who knows will save me spending
> a 
> couple of days trying to decode sequences like ./*\a@\n&$/  which
> seem to 
> make perl programmers very proud when they write them.
> 
> Tom Droege 
> 
> 


=====
Chris Albertson 
  Home:   310-376-1029  chrisalbertson90278@yahoo.com
  Cell:   310-990-7550
  Office: 310-336-5189  Christopher.J.Albertson@aero.org

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com