Given a file like this:
$ cat file
hello/how/are/you
i am fine
You can use /pattern/
to match specific lines:
$ sed -n '/hello/p' file
hello/how/are/you
If the pattern contains slashes itself, you can use another delimiter using \cBREc
:
$ sed -n '\#hello/how#p' file
hello/how/are/you
$ sed -n '\_hello/how_p' file
hello/how/are/you
As defined by POSIX in:
Regular Expressions in sed
In a context address, the construction\cBREc
, where c is any character other than backslash or , shall be identical to/BRE/
. If the character designated by c appears following a backslash, then it shall be considered to be that literal character, which shall not terminate the BRE. For example, in the context address "\xabc\xdefx", the second x stands for itself, so that the BRE is "abcxdef".