Is it possible to use only one combination of grep and regexp to achieve the following. Let's say I have a file like this:
$ cat f.txt line 1 foo line 2 boo no match line 3 blank line X no match
I want to combine all the lines starting with the word line , and then the number, but only display what happens after that, so the part that matches (.*) .
$ grep -E '^line [0-9]+(.*)' f.txt line 1 foo line 2 boo line 3 blank
Can you tell a coincidence, but not display this part ^line [0-9]+ , for example, do the opposite to grep -o '^line [0-9]+'
So my expected result would look like this:
$ grep -E ***__magic__*** f.txt foo boo blank
user1814699
source share