Filtering/Finding a "Fortune" message


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Filtering/Finding a "Fortune" message
Prev   Next
# 1  
Old 05-11-2005
Filtering/Finding a "Fortune" message

Hi,

I have had a problem in Linux with the "Fortune" messages (unfortunately! Smilie ) and I need to trap the message again. It starts with a "IMPORTANT NOTICE".

To capture this, I write a script as follows..

#!/bin/sh
a=0
while [$a -lt 1000] ; do
/usr/games/fortune >> fortune.txt
a=`expr $a + 1`
done

Now, the file is so big and I haven't been recapture the message yet. So I want to do the following. If the output from the command '/usr/games/fortune' contains the string "IMPORTANT", then I want to store it or else dont. Any suggestions?

Thanks,
OldTrash
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Homework & Coursework Questions

Need help creating shell script with output that has 2014 calendar and 2 text items from a"fortune"

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I am required to create a bash shell script with either emacs or vi. It must include the year 2014 calendar on... (9 Replies)
Discussion started by: dandanhelpmeman
9 Replies

5. Shell Programming and Scripting

finding the strings beween 2 characters "/" & "/" in .txt file

Hi all. I have a .txt file that I need to sort it My file is like: 1- 88 chain0 MASTER (FF-TE) FFFF 1962510 /TCK T FD2TQHVTT1 /jtagc/jtag_instreg/updateinstr_reg_1 dff1 (TI,SO) 2- ... (10 Replies)
Discussion started by: Behrouzx77
10 Replies

6. UNIX for Dummies Questions & Answers

Unix "look" Command "File too large" Error Message

I am trying to find lines in a text file larger than 3 Gb that start with a given string. My command looks like this: $ look "string" "/home/patrick/filename.txt" However, this gives me the following message: "look: /home/patrick/filename.txt: File too large" So, I have two... (14 Replies)
Discussion started by: shishong
14 Replies

7. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

8. Shell Programming and Scripting

What is "fortune" for UNIX ????

Hello sir, I was reading about "fortune". From the following link:- fortune (Unix) - Wikipedia, the free encyclopedia It was very informative.I want to install the package if available.Can you please give me the link download.Can you tell me in what kind of applications we make use of it.I... (1 Reply)
Discussion started by: nsharath
1 Replies

9. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies
Login or Register to Ask a Question
Class::Accessor::Class(3pm)				User Contributed Perl Documentation			       Class::Accessor::Class(3pm)

NAME
Class::Accessor::Class - simple class variable accessors VERSION
version 0.501 $Id: /my/cs/projects/claccl/trunk/lib/Class/Accessor/Class.pm 27922 2006-11-13T16:05:47.533928Z rjbs $ SYNOPSIS
Set up a module with class accessors: package Text::Fortune; use base qw(Class::Accessor::Class Exporter); Robot->mk_class_accessors(qw(language offensive collection)); sub fortune { if (__PACKAGE__->offensive) { .. Then, when using the module: use Text::Fortune; Text::Fortune->offensive(1); print fortune; # prints an offensive fortune Text::Fortune->language('EO'); print fortune; # prints an offensive fortune in Esperanto DESCRIPTION
Class::Accessor::Class provides a simple way to create accessor and mutator methods for class variables, just as Class::Accessor provides for objects. It can use either an enclosed lexical variable, or a package variable. This module was once implemented in terms of Class::Accessor, but changes to that module broke this relationship. Class::Accessor::Class is still a subclass of Class::Accessor, strictly for historical reasons. As a side benefit, a class that isa Class::Accessor::Class is also a Class::Accessor and can use its methods. METHODS
mk_class_accessors package Foo; use base qw(Class::Accessor::Class); Foo->mk_class_accessors(qw(foo bar baz)); Foo->foo(10); my $obj = new Foo; print $obj->foo; # 10 This method adds accessors for the named class variables. The accessor will get or set a lexical variable to which the accessor is the only access. mk_package_accessors package Foo; use base qw(Class::Accessor::Class); Foo->mk_package_accessors(qw(foo bar baz)); Foo->foo(10); my $obj = new Foo; print $obj->foo; # 10 print $Foo::foo; # 10 This method adds accessors for the named class variables. The accessor will get or set the named variable in the package's symbol table. DETAILS
make_class_accessor $accessor = Class->make_class_accessor($field); This method generates a subroutine reference which acts as an accessor for the named field. make_package_accessor $accessor = Class->make_package_accessor($field); This method generates a subroutine reference which acts as an accessor for the named field, which is stored in the scalar named "field" in "Class"'s symbol table. This can be useful for dealing with legacy code, but using package variables is almost never a good idea for new code. Use this with care. AUTHOR
Ricardo SIGNES, "<rjbs@cpan.org>" BUGS
Please report any bugs or feature requests to "bug-class-accessor-class@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. COPYRIGHT
Copyright 2004-2006 Ricardo Signes, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.3 2006-11-13 Class::Accessor::Class(3pm)