Re: Compiling SPECFUN and similar libraries
- From: fj <francois.jacq@xxxxxxx>
- Date: Thu, 31 Jul 2008 08:46:17 -0700 (PDT)
On 31 juil, 16:54, deltaquattro <deltaquat...@xxxxxxxxx> wrote:
Hi,
I often find in libraries downloaded from Netlib that some lines start
with CS or CD, like this:
CS REAL
CD DOUBLE PRECISION
To compile a single/double precision version of the code, all
occurences of CS/CD in the first two columns must be changed to
blanks. How can I do this automatically? Most text editors can replace
a string with another, also specifying that the first string must be a
whole word (in this way I avoid eliminating occurences of CS/CD inside
bigger strings) but I'd prefer to explicitly specify that CS/CD must
occur in the first two columns of a line. Maybe I want to be a bit too
safe :-) but since I have seen this "trick" so often in many
libraries, I was wondering if there is some standard Unix utility
which is commonly used to do this.
Best Regards,
deltaquattro
sed -e "s/^CS//" myfile.f > myfile.withoutCS
sed is called the Stream EDitor. To change CS and CD together :
sed -e "s/^CS//" -e "s/^CD//" myfile.f > myfile.withoutCSCD
meaning of the string after -e :
" : start of an instruction
s : change
/ : delimiter
^ : start of a line
CD : the string to modify
/ : delimiter
.... : the replacing string (here empty)
/ : final delimiter
" : end of the instruction
Of course you can apply it on many files using a loop :
for i in *.f ; do
j=`basename $i`
sed -e "s/^CS//" -e "s/^CD//" $i > $j.withoutCSCD
done
.
- Follow-Ups:
- Re: Compiling SPECFUN and similar libraries
- From: deltaquattro
- Re: Compiling SPECFUN and similar libraries
- References:
- Compiling SPECFUN and similar libraries
- From: deltaquattro
- Compiling SPECFUN and similar libraries
- Prev by Date: Re: Compiling SPECFUN and similar libraries
- Next by Date: Re: Compiling SPECFUN and similar libraries
- Previous by thread: Re: Compiling SPECFUN and similar libraries
- Next by thread: Re: Compiling SPECFUN and similar libraries
- Index(es):
Relevant Pages
|