RosettaCodeData/Task/String-matching/Sed/string-matching.sed
2026-04-30 12:34:36 -04:00

11 lines
308 B
Sed

# 1. Determining if the first string starts with the second string:
N;/^\(.*\).*\n\1$/!d;s/\n.*//
# 2. Determining if the first string contains the second string at any location:
N;/.*\(.*\).*\n\1$/!d;s/\n.*//
# 3. Determining if the first string ends with the second string:
N;/\(.*\)\n\1$/!d;s/\n.*//