Something like this should work...

users="user1 user2 user3 user4 user5"
file=<name of file>

for user in $users; do
grep $user $file >/dev/null && cat $file > /tmp/"$user"_`date
+%Y-%m-%d-%H:%m` && break
done

--- - Toby Stanfill
--- - Sr. Programmer/Analyst
--- - O'Reilly Auto Parts
--- - (417)862-2674 ext. 1291

This message is protected by the Electronic Communications Privacy Act, 18
USCS § 2510 et seq., and may not be used, copied or forwarded without the
consent of the named recipient(s). The information contained in this
message is confidential, is intended only for the use of the individual or
entity named. If the reader of this message is not the intended recipient,
you are hereby notified that any dissemination, distribution or copying of
this communication is strictly prohibited. If you have received this
communication in error, please notify me immediately at 417-862-2674 ext
1291.




"Mitch Martin"
<mmartin@monroenc
.org> To
Sent by: <LINUX5250@xxxxxxxxxxxx>
linux5250-bounces cc
@midrange.com
Subject
[LINUX5250] Script file to
08/08/2008 09:41 customize scs2ascii output -
AM Assistance needed.


Please respond to
Linux 5250
Development
Project
<linux5250@midran
ge.com>







Hello all,

I've been using tn5250 on a Linux server for over a year and sending i5
print sessions to Windows network printers while converting the output
to ascii, pdf and even tiff. It's the greatest thing since sliced
bread!! ;-)

I now have a need for something a little different and I'm asking for
any hints on the best way to accomplish it. (Not being a bash scripting
guru, myself)

I want to take the output of scs2ascii and search that output for a
user's name. Each output is a document containing 1 of 5 possible user
names. I then want to write that output as a file using the user name
as the filename and maybe adding the current date and time. I may want
to further process or format that output but I can probably manage that
with enscript as I've been doing.

My thoughts are to setup variables with the 5 user names and then use
grep to test for each user, check the return status code for a match and
then write the filename. That is overly simplified, of course. I'm
currently reading a shell programming book and hoping to put a script
together but would appreciate any guidance from the more experienced
programmers on this list.

Thanks for any help.

Regards,
Mitch


--
This is the Linux 5250 Development Project (LINUX5250) mailing list
To post a message email: LINUX5250@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/linux5250
or email: LINUX5250-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/linux5250.


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean (mailgw2:2A5EA1F4BCF.F13CC).




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.