sarbjit
1
Hi,
I am having a text file with following contents:
[space][space][space]word
[space][space][space][space][space]word
I want to grep the first line i.e. word that is being preceded with three space characters.
So i tried
sed -n '/ {3}/p' filename
grep " {3}" filename
But is not returning any result. If i don't use {}, then it returns both the patterns.
$ awk ' /^ [A-Za-z0-9]/ ' filename
ABC
FGH
sarbjit
3
Yes that will return both the lines, i want only that pattern which is having only three white spaces in front of it.
my test file has the below lines.
bash-3.00$ cat test
ABC
CDE
FGH
$ awk ' /^ [A-Za-z0-9]/ ' test
ABC
FGH
it returns only the 3 space lines. Make sure you are giving three space in between the /^ [A
You could try as above highlighted..