Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I want to use "awk" or sed to print all the lines that start with "comm=" in a file

I want to use "awk" or "sed" to print all the lines that start with comm= from the file filex, Note that each line contains "comm=somthing"

for example : comm=rm , comm=ll, comm=ls  ....

How can i achieve that ?

like image 923
wael Avatar asked Nov 30 '11 13:11

wael


1 Answers

For lines that start with comm=

sed -n '/^comm=/p' filex

awk '/^comm=/' filex

If comm= is anywhere in the line then

sed -n '/comm=/p' filex

awk '/comm=/' filex
like image 184
jaypal singh Avatar answered Oct 21 '22 01:10

jaypal singh