I try to search for lines that start with "1" using
ls -1 | grep ^1*
but it returns lines that do not start with 1. What I am missing here?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
^1.* matches the whole line, or just as said above, ^1 got the string contained in the line.
different styles of regex uses different symbols representing chars, some options specify which style you want. and different options specify whether you want to match the whole line, or just part of it, or the whole input as one string.