regex - Parsing text using grep -


i have textfile called netlist.txt following contents:

m1      nmos1  m2      nmos2  p1      pmos1          m3      nmos3                  m4      nmos4                         p2      pmos2 

i want retrieve line starts tab/space , matching "m" values indented, using regex.

in order accomplish entered following expression in bash:

egrep [:space:]*[m][0-9]+ netlist.txt 

but doesn't recognize space. retrieves lines regardless of having space or not. please give me advice on this. thanks, pedro

you can use:

grep '^[[:blank:]]m[0-9]' file 

output:

        m3      nmos3 

[[:blank:]] matches either single space or single tab @ line start. [[:space:]] on other hand matches space or tab or newline.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -