Quantcast
Channel: How to use grep to get the matching part only, without introducing extra newlines - Unix & Linux Stack Exchange
Browsing index pages (4 articles)
↧

Answer by jubilatious1 for How to use grep to get the matching part only,...

Using Raku (formerly known as Perl_6)~$ raku -ne 'put join "", m:g/ ban <[a..z]>* /;' file#OR~$ raku -ne 'put join "", m:g/ ban <alpha>* /;' fileRaku is a programming language in the...

View Article


Answer by Jonathan Cabrera for How to use grep to get the matching part only,...

Assuming you are using GNU grep:To prevent grep from adding a line break after each match you must use the -z option.Since with the -z option grep will no longer add any line breaks automatically, it...

View Article


How to use grep to get the matching part only, without introducing extra...

I have a output from a command that I want to pipe to some kind of grep command to obtain the part in each line that matches a given regex, and only output the matching part, without introducing...

View Article

Answer by steeldriver for How to use grep to get the matching part only,...

If you don't mind using perl:mycommand | perl -lne 'print join "", /ban[a-z]*/g'The matches on each line are returned in a list context, which you can join with an empty delimiter.

View Article
Browsing index pages (4 articles)


Latest Images