On Thu, 4 Jun 2015 11:05:15 -0400, Shmuel Metz (Seymour J.) wrote:

>In <4767436570688083.wa.bgodfrey.gzgmail....@listserv.ua.edu>, on
>06/01/2015
>   at 10:18 PM, Bill Godfrey said:
>
>>The "grep" and "awk" commands don't match \n to end-of-line on omvs,
>>or on linux for that matter.
>
>Don't they match \n to LF on most Eunix and *ix systems?
>
In awk there are regex patterns for the input data and there are regex patterns 
for strings. The regex patterns for the input data are like patterns in grep, 
in that they do not match \n with anything, but they do match $ with 
end-of-line.

>Do '/test$/' and '/test\n/' have the same semantics in awk? In grep?
>
'/test\n/' doesn't match anything in grep or in awk's pattern for input data.

'/test$/' matches "test" at end-of-line in grep or in awk's pattern for input 
data.

In awk's pattern for strings, "test\n" (without slashes) matches "test\n" 
anywhere within a string, which could have multiple \n characters, whereas 
"test$" matches "test" at the end of the string if the string has no \n at the 
end. You would need "test\n$" to match "test\n" at the end of a string.

Bill

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to