Last active
September 1, 2022 11:55
-
-
Save cftang0827/77820c4b55f0e607b155e74f25330918 to your computer and use it in GitHub Desktop.
Grep from line separated file keywords
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/questions/1251999/how-can-i-replace-each-newline-n-with-a-space-using-sed | |
cat test | grep -E $(cat target | sed ':a;N;$!ba;s/\n/|/g') | |
# test | |
# | |
# Hey yoyo | |
# today is a good day | |
# word1 is good | |
# word2 is not good | |
# you are good | |
# hello world | |
# yayayay | |
# target | |
# | |
# word1 | |
# word2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment