3

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
10
grep '^0x'

^ means the starting of a line

e.g.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.