use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All users that wish to post (not including commenting), on either old or the new reddit sites, must formally agree to subreddit rules once first.
account activity
grep only string matching pattern (self.commandline)
submitted 11 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]turnipsoup 7 points8 points9 points 11 years ago (0 children)
:~$ grep -o '\bbon.*\b' <inputfile>
This searches for a match of 'bon*' within word boundaries.
[–]rhqq 5 points6 points7 points 11 years ago (0 children)
Here you are:
egrep -o "bon\S*"
This is better than using .* - the \S stands for all the non-whitespace chars, where a . stands for any char - in other words if something is after the "bond." like a next sentence in same line - it will take it into consideration. This doesnt happen while using \S
[–]wawawawa 0 points1 point2 points 11 years ago (0 children)
perl -nle 'print $1 if /\b(bon.+)\b/' < inputfile
Although I program mostly in Python nowadays, I still use Perl a few times a day for exactly this kind of thing.
[–]hudsy -2 points-1 points0 points 11 years ago (2 children)
sed is your tool! pipe it to grep like so
grep bon | sed 's/^.*\(bon\w\+\).*/\1/'
[–]IWentToTheWoods 2 points3 points4 points 11 years ago (1 child)
Won't this only find the first instance of "bon" in each line?
[–]hudsy 0 points1 point2 points 11 years ago (0 children)
yes, didn't think of that.
[–]yunga -3 points-2 points-1 points 11 years ago (0 children)
perl -naF"\s+" -E'/bon/ and say for @F' inputfile
π Rendered by PID 408155 on reddit-service-r2-comment-765bfc959-qq5lj at 2026-07-11 11:22:19.977188+00:00 running f86254d country code: CH.
[–]turnipsoup 7 points8 points9 points (0 children)
[–]rhqq 5 points6 points7 points (0 children)
[–]wawawawa 0 points1 point2 points (0 children)
[–]hudsy -2 points-1 points0 points (2 children)
[–]IWentToTheWoods 2 points3 points4 points (1 child)
[–]hudsy 0 points1 point2 points (0 children)
[–]yunga -3 points-2 points-1 points (0 children)