0

I have a file that looks like this

# ... stuff

@late() def test1(): # ...

@late() def test2(): # ...

I need to get each match after the @late() line and do some work on them.

I've tried getting the line after using awk '/^@late()/{getline; print}' $the_file_path. The results are correct but when I iterate over the matches

for line in `awk '/^@late()/{getline; print}' $the_file_path`
do
    echo $line
done

I get

def
test1():
def
test2():

As you can see, the "def test1()" and "def test2()" are split at the " ".

Desired print output

def test1():
def test2():

I've tried surrounding each line in quotes to prevent it from breaking at the space but have had no luck. Can I get a pointer on how to handle this case?

0 Answers0