Skip to main content

Timeline for Grep for words not lines

Current License: CC BY-SA 4.0

6 events
when toggle format what by license comment
Mar 30, 2022 at 18:25 comment added frabjous -o doesn't use a different kind of regex; it is just an option for grep which makes it so it only outputs the matches rather than the entire lines containing the matches (grep's normal behavior), and if there is more than one match on the same line, it puts them on separate lines in the output. See the man page for GNU grep (or man grep in the terminal).
Mar 30, 2022 at 18:06 comment added magnus reeves thank u so much, would u mind sharing me a resource where I can find other documentation on the -o regix? I have a billion more question I dont want to bug you with. I think its called string matching regix? Sorry I'm brand new to this in school I don't know if my questions make sense
Mar 30, 2022 at 17:48 comment added frabjous Assuming a "word" can only have letters in it you could use \<a[A-Za-z]*b\>; if what you count as "words" can have other things in them like hyphens or underscores or digits, you may need to add to what's in the brackets.
Mar 30, 2022 at 17:32 comment added magnus reeves spectacular, if I wanted to include words that began with 'a' but ended with 'b', how would that look?
Mar 30, 2022 at 17:04 vote accept magnus reeves
Mar 28, 2022 at 23:45 history answered frabjous CC BY-SA 4.0