help-gawk
[Top][All Lists]
Advanced

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

Re: Parsing multiline string line by line


From: david kerns
Subject: Re: Parsing multiline string line by line
Date: Thu, 2 Mar 2023 07:40:01 -0700

$ cat /tmp/a.awk
awk 'BEGIN {
str=" \n \
Here is the first line \n \
Another line \n \
Additional infarmation \n"
print str
n = split(str, a, "\n")
print n, a[3]
}'
$ bash /tmp/a.awk

 Here is the first line
 Another line
 Additional infarmation

5  Another line

On Thu, Mar 2, 2023 at 7:35 AM david kerns <david.t.kerns@gmail.com> wrote:

> RS sets the record separator. (default is new line) you can set it to
> anything .. search for "awk rs examples"
>
> On Thu, Mar 2, 2023 at 7:32 AM goncholden via Help-gawk <help-gawk@gnu.org>
> wrote:
>
>> Is it possible to loop an awk string line by line ?
>>
>> For instance, consider
>>
>> str=" \n \
>> Here is the first line \n \
>> Another line \n \
>> Additional infarmation \n"
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]