Issue
Sample file : abc.ksh
echo "This is a sample file." >> mno.txt
echo "\nThis line has new line char." >> mno.txt
I want
echo "\nThis line has new line char." >> mno.txt
as output.
Solution
Use -F
to match fixed strings:
$ grep -F "\n" file
echo "\nThis line has new line char." >> mno.txt
From man grep
:
-F, --fixed-strings
Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched. (-F is specified by POSIX.)
Answered By - fedorqui Answer Checked By - Mary Flores (WPSolving Volunteer)