Is there a way to print a specific row (without using pattern matching) like we use to print column ($1, $2, $3 etc)?
My Text file:
Hi
How are you?
I am from California.
Is there any special characters to achieve this like $1, $2, $3 etc...?
Using sed:
~$ sed -n '3p' myfile
I am from California.
Using awk
~$ awk 'NR==3' myfile
I am from California.
If the file is large, you should exit when the line is found:
Using sed:
~$ sed -n '3{p;q}' myfile
I am from California.
Using awk
~$ awk 'NR==3{print;exit}' myfile
I am from California.