LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-27-2017, 03:17 PM   #1
RobertLM78
LQ Newbie
 
Registered: Jun 2012
Location: Albuquerque, USA
Distribution: Linux Mint
Posts: 7
Blog Entries: 1

Rep: Reputation: Disabled
Fortune - ignore option


I like fortune, and it's fun having them come up when I open a terminal window, but yesterday I was given a fortune (under wisdom of all things) from the turd Arthur Balfour. I WILL NOT have that a$$hat in my fortunes.

Reading the man page, I saw that there is an -i option for ignore, which appears to be used with the -m option (pattern). I've tried a few things, but I'm really not sure how to use this two options together. I've tried:

Code:
$ fortune -i -m Balfour
$ fortune -im Balfour
$ fortune -m Balfour -i
Which mostly just gives the listing of fortunes that match the pattern. So how do I ignore a pattern, and is there some way to confirm that a pattern has been put on ignore?
 
Old 04-27-2017, 04:40 PM   #2
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
I think you'll have to edit the file(s) to remove the quotes that you don't want to see.

Simple enough to do. Using the wisdom file as an example:
Quote:
...
%
Nothing is so firmly believed as that which we least know.
-- Michel de Montaigne
%
Nothing matters very much, and few things matter at all.
-- Arthur Balfour

%
Of all men's miseries, the bitterest is this:
to know so much and have control over nothing.
-- Herodotus
%
...
Edit /usr/share/games/fortunes/wisdom to remove the Balfour quote.
Then run "strfile wisdom" to create the .dat file (see man strfile)
 
1 members found this post helpful.
Old 04-27-2017, 05:24 PM   #3
RobertLM78
LQ Newbie
 
Registered: Jun 2012
Location: Albuquerque, USA
Distribution: Linux Mint
Posts: 7

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Cool

Quote:
Originally Posted by norobro View Post
I think you'll have to edit the file(s) to remove the quotes that you don't want to see.

Simple enough to do. Using the wisdom file as an example:


Edit /usr/share/games/fortunes/wisdom to remove the Balfour quote.
Then run "strfile wisdom" to create the .dat file (see man strfile)
Awesome - that's perfect! I'd thought about just editing the wisdom file, but then there was that .dat file there... which I assume is the one actually used by fortune. I'll have to learn about 'strfile'.... didn't realize re-creating that file would be that easy! Thank you norobro!

Edit: Just so that you know - it worked perfectly! Thank you very much!

Last edited by RobertLM78; 04-27-2017 at 05:31 PM.
 
Old 04-27-2017, 06:18 PM   #4
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth&Mars (I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that work on freest-HW; has been KDE, CLI, Novena-SBC but open.. http://goo.gl/NqgqJx &c ;-)
Posts: 4,888
Blog Entries: 2

Rep: Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567
So if you're the problem with the world will adding you to my ignore list (like a little girl) work?
 
Old 04-28-2017, 01:46 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
recompiling the database?
not sure about that.

first of all, the '-i' option means
Quote:
Originally Posted by man fortune
-i Ignore case for -m patterns.
that means: balfour == Balfour.

I think what you want is either not possible with fortune, or you have to come up with some regex that says "NOT Balfour":
Quote:
Originally Posted by man fortune
-m pattern
Print out all fortunes which match the basic regular expression pattern. The syntax
of these expressions depends on how your system defines re_comp(3) or regcomp(3),
but it should nevertheless be similar to the syntax used in grep(1).
also i'm worried about "all" in the first sentence...?
 
Old 04-28-2017, 08:13 AM   #6
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Quote:
Originally Posted by ondoho View Post
also i'm worried about "all" in the first sentence...?
The way that I interpret that is if you could use "NOT Balfour" (I couldn't get that to work) you would get all of the other entries in the file.

The first line in the Description in the man page:
Quote:
When fortune is run with no arguments it prints out a random epigram.
 
Old 04-29-2017, 02:14 PM   #7
RobertLM78
LQ Newbie
 
Registered: Jun 2012
Location: Albuquerque, USA
Distribution: Linux Mint
Posts: 7

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Thumbs down

Quote:
Originally Posted by jamison20000e View Post
So if you're the problem with the world will adding you to my ignore list (like a little girl) work?
Very Ⓚo$her!! Are you sure I'm not a snowflake?

Last edited by RobertLM78; 04-29-2017 at 02:34 PM.
 
  


Reply

Tags
fortune


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DHCPLEASEQUERY ignore option? quemlar Linux - Networking 2 09-26-2013 02:37 PM
[SOLVED] Sendmail ignore RunAsUser option Pavel Samsonov Linux - Server 4 08-27-2010 04:39 AM
[SOLVED] rsync still copies with ignore existing option digity Linux - Newbie 2 07-14-2010 01:12 PM
cp command: except or ignore option? C-RAF. Programming 9 02-28-2006 03:23 AM
fortune drigz Linux - Software 3 06-26-2004 10:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration