getline Subroutine

public subroutine getline(unit, pattern, buffer)

Get the line from a grep and assign it to buffer

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: unit

Unit to read from

character(len=*), intent(in) :: pattern

Pattern to grep for

character(len=*), intent(out) :: buffer

Buffer to assign line to


Source Code

  subroutine getline(unit, pattern, buffer)
    !! Get the line from a grep and assign it to buffer
    implicit none

    ! Arguments
    integer, intent(in) :: unit
    !! Unit to read from
    character(*), intent(in) :: pattern
    !! Pattern to grep for
    character(*), intent(out) :: buffer
    !! Buffer to assign line to

    ! Local variables
    integer :: iostat
    !! I/O status

    call grep(unit, pattern)
    backspace(unit)
    read(unit, '(A)', iostat=iostat) buffer
  end subroutine getline