4

How can I grep for lines of a file wich start with a certain string?

For example, all lines with prefex 0x, where the file has the lines

0x002
0x003
abc

Output should be

0x002
0x003
0

1 Answer 1

12
grep '^0x'

^ means the starting of a line

e.g.

kent$  echo "0x002
0x003
abc
"|grep '^0x'
0x002
0x003

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .