I need to search a pattern I/f in a file between some range of lines and quit on the first match. For that I am using sed command like this
sed -n '14922,28875{\|I/f|=}' file.txt
It actually prints all the occurence between line 14922 to 28875 but I want only first occurence.
I have one alternate solution for this which is to pipe line the output and use head command. Something like that
sed -n '14922,28875{\|I/f|=}' file.txt | head -n 1
It works but just wondering if it is possible without head command. I searched on the internet and I found we use q character but somehow I am not getting right place to insert that in my command. Can anyone please help me in this