I'm on Ubuntu 16.04
Trying:
grep '.*' file1
Output:
file nu-mber o-ne
second string
Trying: grep '.+' file1
Output is absent
Why plus is not working?
I'm on Ubuntu 16.04
Trying:
grep '.*' file1
Output:
file nu-mber o-ne
second string
Trying: grep '.+' file1
Output is absent
Why plus is not working?
You need to tell grep you're using an extended regular expression:
grep -E '.+' file1
The standard Basic Regular Expression (as used by grep without -E) equivalent of the Extended Regular Expression + operator is \{1,\} though some implementations (like GNU's) also recognise \+ for that as an extension (and you can always use ..*).
(Note that in this particular case grep -E .+ is equivalent to grep -E . as you're looking for substrings matching the regex when not using the -x option. On many systems egrep is provided as an equivalent command to grep -E, but as Graeme points out this is obsolete.)
With GNU grep (default on Ubuntu) you can also enable extended behavior with a backslash. Eg:
grep '.\+' file1
I believe + is an extended regular expression metacharacter. Try using egrep.