I'm stuck in finding a way to modify multiple lines in multiple files that contain specific words/characters but not others. To be more specific, a would like to transform all variable declarations in fortran files from real to real(kind=r8). For example the lines below:
var= (var1*REAL(j)-var2*REAL(j)*var3)REAL :: pwr10INTRINSIC REALREAL(kind=r16) :: qr(n), qaorg, qxREAL, DIMENSION(-1:nx, -1:ny) :: arg1REAL(kind=r8) :: y3
should become:
var= (var1*REAL(j)-var2*REAL(j)*var3)REAL(kind=r8) :: pwr10INTRINSIC REALREAL(kind=r16) :: qr(n), qaorg, qxREAL(kind=r8), DIMENSION(-1:nx, -1:ny) :: arg1REAL(kind=r8) :: y3
I know how to select the specific lines using grep but not using sed to modify them. can someone help please?