UNIX UNIX tools Automating LIS Administration

Slides:



Advertisements
Similar presentations
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Advertisements

“What do you want me to do now?”
Scheduling Discoverer Reports Scheduling Standard Reports Printing & Re-printing Standard Reports Focus on Reports Session 2 To print: Right click Choose.
CS 497C – Introduction to UNIX Lecture 31: - Filters Using Regular Expressions – grep and sed Chin-Chih Chang
Linux+ Guide to Linux Certification, Second Edition
Guide To UNIX Using Linux Third Edition
Filters using Regular Expressions grep: Searching a Pattern.
Advanced File Processing
Using the Unix Shell There is No ‘Undelete’. The Unix Shell “A Unix shell is a command-line interpreter or shell that provides a traditional user interface.
1 TAC2000/ IP Telephony Lab Advanced Linux Administration Language: Offered in English Instructor: Dr. Quincy Wu (
System Programming Regular Expressions Regular Expressions
Exam Revision. Exam Details Time 90 minutes (1hour 30 minutes). Six questions! How long per question? Five parts per question. How long for each part?
1 Operating Systems Lecture 3 Shell Scripts. 2 Brief review of unix1.txt n Glob Construct (metacharacters) and other special characters F ?, *, [] F Ex.
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Guide To UNIX Using Linux Fourth Edition
Unix Talk #2 (sed). 2 You have learned…  Regular expressions, grep, & egrep  grep & egrep are tools used to search for text in a file  AWK -- powerful.
Service Request Desk How we can help each other, help each other.
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
CIS 218 Advanced UNIX1 CIS 218 – Advanced UNIX (g)awk.
Selecting, Formatting, and Printing a finished Report…….
Perl and Regular Expressions Regular Expressions are available as part of the programming languages Java, JScript, Visual Basic and VBScript, JavaScript,
Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command to search for.
Linux+ Guide to Linux Certification, Third Edition
Chapter Five Advanced File Processing Guide To UNIX Using Linux Fourth Edition Chapter 5 Unix (34 slides)1 CTEC 110.
Chapter Five Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command.
Agenda Regular Expressions (Appendix A in Text) –Definition / Purpose –Commands that Use Regular Expressions –Using Regular Expressions –Using the Replacement.
BIF713 Additional Utilities. Linux Utilities  You have learned many Linux commands. Here are some more that you can use:  Data Manipulation (Reg Exps)
I/O Redirection and Regular Expressions February 9 th, 2004 Class Meeting 4.
Chapter Five Advanced File Processing. 2 Lesson A Selecting, Manipulating, and Formatting Information.
Chapter Three The UNIX Editors.
Linux+ Guide to Linux Certification, Second Edition
FILTERS USING REGULAR EXPRESSIONS – grep and sed.
CSC 352– Unix Programming, Fall 2011 November 8, 2011, Week 11, a useful subset of regular expressions, grep and sed, parts of Chapter 11.
Unix tools Regular expressions grep sed AWK. Regular expressions Sequence of characters that define a search pattern banana matches the text banana
Linux Administration Working with the BASH Shell.
Zortec Business Tax: Session 2 Local Government Corporation
Scripting (Just one of many tools.) P. Bailey. No, not this kind of scripting….  I wanted to find some cool graphics on scripting and I got….
CSE 303 Concepts and Tools for Software Development Richard C. Davis UW CSE – 10/9/2006 Lecture 6 – String Processing.
PROGRAMMING THE BASH SHELL PART III by İlker Korkmaz and Kaya Oğuz
Regular Expressions Copyright Doug Maxwell (
SQL Database Management
Global Card Management System (GCMS)
Lesson 5-Exploring Utilities
Development Environment
CSC 352– Unix Programming, Spring 2016
UNIX basics Run Faster, Jump Higher, Finish First, Win The Gold
Looking for Patterns - Finding them with Regular Expressions
11 Scheduling.
Agenda Bash Shell Scripting – Part II Logic statements Loop statements
CST8177 sed The Stream Editor.
Guide To UNIX Using Linux Third Edition
Unix Scripting Session 4 March 27, 2008.
State Report Processing
PROGRAMMING THE BASH SHELL PART IV by İlker Korkmaz and Kaya Oğuz
Vi Editor.
How to… Use Crontab for SFX
CSC 352– Unix Programming, Fall 2012
What is Bash Shell Scripting?
The ‘grep’ Command Colin Masterson.
Guide To UNIX Using Linux Third Edition
Reporting An In-Depth Guide.
Lecture 5 Additional useful commands COP 3353 Introduction to UNIX 1.
Unix Talk #2 (sed).
Chapter Four UNIX File Processing.
CSE 303 Concepts and Tools for Software Development
Regular Expressions and Grep
Introduction to Bash Programming, part 3
Lecture 5 Additional useful commands COP 3353 Introduction to UNIX 1.
Review.
Presentation transcript:

UNIX UNIX tools Automating LIS Administration Corbin Ellsaesser SNUG SIG Coordinator Sr. IT Systems Engineer Christiana Care Health Systems Delaware cde@christianacare.org

Did someone say UNIX ? Purpose of this session: Z zz Z Did someone say UNIX ? Purpose of this session: To open your eyes to new possibilities. Demonstrate ways we use UNIX scripts to make LIS support easier. NOT to teach you how to program in UNIX. Programming ?

Why UNIX ? UNIX was designed to manipulate text Search, edit, reformat information all without altering the original document. THE most powerful search options you’ll ever use Not limited to ? And * like most Windows programs BRE & ERE are the key Basic and Extended Regular Expressions

Who loves the Soft Error Logs? How many of you: Love that they are cumulative for a month? Love that they are packed with useful information? Search the logs looking for issues to resolve before they become problems? Go through the error logs daily? Only go to the logs after a problem has been brought to your attention? So the rest of you are like …

Let UNIX do the leg work. How would you like to be emailed error log reports? Error Log Examples

Let UNIX find what’s important And email you a daily report Our script only reports significant errors that were logged since the last report was sent. Our report is emailed to the team at 0700 each day. Monday’s report covers last Friday through today. Tuesday through Friday cover yesterday through today. A blank report means no errors to work up.

Printer Queues How do you maintain them? How often do you check printer queue statuses? Do you leave it to the users to report or fix their own? Do you print to doctor’s offices? Oncology? Autoreports? What do you do if the office is on extended holiday? Printer jobs queue up because it’s out of paper/toner? Their print jobs purge before they can print? How do you know? What do you do? Wait for them to call for reprints?

Automate Queue Maintenance UNIX script scheduled on cron Automatically check and restart stopped queues every 15 minutes 24/7. “touch” unprinted files so they don’t purge as long as they’re queued. touch  changes file’s system date to “now” every 15 min. until the file prints. Email report to LIS Admin once an hour, during business hours, for queues that won’t start, won’t ping, or are “RUNNING” but not printing. Sample report.

UNIX tools (scripts) Automate searching, extracting and reformatting interface trace file records. Automate billing file searches. Scrub PHI from data to attach to Tasks

UNIX tools (scripts) Demonstration Note: Our HIS system is Cerner PowerChart Also known as HNAM Our HIS financial system is Soarian Old method ADT message troubleshooting Missing BMP troubleshooting Scrubbing information to attach to Tasks Billing file troubleshooting

What does UNIX look like? grcv script is about 18 lines long #! /usr/bin/ksh Rcv="$UDIR/db/dat/I/HIS/RES*/rcv.trace" sed -e '/\([0-9]\{2\}:\)\([0-9]\{2\}:\)\([0-9]\{2\}\.[0-9]\{3\}\)\.\ Program=</,/rq_Open(<hislisMAIN>)\ OK/d' \ -e '/^.*|ACK|.*$/,/^.*\\r>$/d' \ -e '/^\ ---/d' \ -e '/r.*\.\.\.$/d' \ -e '/^\([0-9]\{2\}:\)\([0-9]\{2\}:\)\([0-9]\{2\}\.[0-9]\{3\}\) .*len=[0-9]*$/d' \ -e '/^<.*>$/d' \ -e 's/^\([0-9]\{2\}:\)\([0-9]\{2\}:\)\([0-9]\{2\}\.[0-9]\{3\}\) \ .*\(MSH.*$\)/<r>\\r\1\2\3\\r\\r\4/g' $Rcv | perl -lne 'if (/<r>/){printf "\n$_"} else {printf} END{print}' | sed 's/\\r\\28\/>\ len=[0-9]*$//g' | grep -hE "$1" | sed -e 's/\\r/\ /g' \ -e 's/<r>//g' exit

Meet our UNIX programming team. I know what you’re thinking . . You’re right... This is our top UNIX script Programmer . .

2 commands you need to know grep sed (globally search a regular expression and print) (scripting with the “ed” UNIX editor) And if you’re have propeller head tendencies –learn awk

Basic/Extended Regular Expressions Regular Expression Metacharacters " ' \ UNIX quotation marks • (dot) Any single character ( similar to ? In Windows) [Hhorse...] Square Brackets: Use any single character within the brackets [^vilains] Caret in brackets: NOT any single character within brackets ( ) Three uses: 1: Used to enclose an "OR" expression sequence - see above 2: Grouping for quantifiers (drunk)? (saloon girl)+ (cow)* 3: Create numbered expressions to be recalled later (see '\1' below) ? Previous expression is optional (repeat zero or more times) + One or more of the previous expression * Repeat Zero to Any number of the previous expression NOTE: Matches as many as possible to the end of document | “OR” (ABC|123) matches strings "ABC" or "123" ^ Start of line $ End of line \1 (\2, \3…) Output numbered expression created above (see '( )' above).

Look again: Now it begins to make sense! sed -e '/\([0-9]\{2\}:\)\([0-9]\{2\}:\)\([0-9]\{2\}\.[0-9]\{3\}\)\.\ Program=</,/rq_Open(<hislisMAIN>)\ OK/d' \ -e '/^.*|ACK|.*$/,/^.*\\r>$/d' \ -e '/^\ ---/d' \ -e '/r.*\.\.\.$/d' \ -e '/^\([0-9]\{2\}:\)\([0-9]\{2\}:\)\([0-9]\{2\}\.[0-9]\{3\}\) .*len=[0-9]*/d' \ -e '/^<.*>$/d' \ -e 's/^\([0-9]\{2\}:\)\([0-9]\{2\}:\)\([0-9]\{2\}\.[0-9]\{3\}\) \ .*\(MSH.*$\)/<r>\\r\1\2\3\\r\\r\4/g' $Rcv | perl -lne 'if (/<r>/){printf "\n$_"} else {printf} END{print}' | sed 's/\\r\\28\/>\ len=[0-9]*$//g' | grep -hE "$1" | sed -e 's/\\r/\ /g' \ -e 's/<r>//g' exit

Look again: Numbered Expressions sed -e '/\([0-9]\{2\}:\)\([0-9]\{2\}:\)\([0-9]\{2\}\.[0-9]\{3\}\)\.\ Program=</,/rq_Open(<hislisMAIN>)\ OK/d' \ -e '/^.*|ACK|.*$/,/^.*\\r>$/d' \ -e '/^\ ---/d' \ -e '/r.*\.\.\.$/d' \ -e '/^\([0-9]\{2\}:\)\([0-9]\{2\}:\)\([0-9]\{2\}\.[0-9]\{3\}\) .*len=[0-9]*$/d' \ -e '/^<.*>$/d' \ -e 's/^\([0-9]\{2\}:\)\([0-9]\{2\}:\)\([0-9]\{2\}\.[0-9]\{3\}\) \ .*\(MSH.*$\)/<r>\\r\1\2\3\\r\\r\4/g' $Rcv | perl -lne 'if (/<r>/){printf "\n$_"} else {printf} END{print}' | sed 's/\\r\\28\/>\ len=[0-9]*$//g' | grep -hE "$1" | sed -e 's/\\r/\ /g' \ -e 's/<r>//g' exit

UNIX grcv script has 4 parts sed -e '/\([0-9]\{2\}:\)\([0-9]\{2\}:\)\([0-9]\{2\}\.[0-9]\{3\}\)\.\ Program=</,/rq_Open(<hislisMAIN>)\ OK/d' \ -e '/^.*|ACK|.*$/,/^.*\\r>$/d' \ -e '/^\ ---/d' \ -e '/r.*\.\.\.$/d' \ -e '/^\([0-9]\{2\}:\)\([0-9]\{2\}:\)\([0-9]\{2\}\.[0-9]\{3\}\) .*len=[0-9]*$/d' \ -e '/^<.*>$/d' \ -e 's/^\([0-9]\{2\}:\)\([0-9]\{2\}:\)\([0-9]\{2\}\.[0-9]\{3\}\) \ .*\(MSH.*$\)/<r>\\r\1\2\3\\r\\r\4/g' $Rcv | perl -lne 'if (/<r>/){printf "\n$_"} else {printf} END{print}' | sed 's/\\r\\28\/>\ len=[0-9]*$//g' | grep -hE "$1" | sed -e 's/\\r/\ /g' \ -e 's/<r>//g' exit

What does each command line do? Do you want to see how it works? Disclaimer: No Trace Files were harmed by running any script. Original files are untouched. Scripts work by reading the file into a data stream and manipulating the flow. Scripts can output to the screen, a file, an email, a printer – anywhere you want to send them. Step by step what the grcv script does

Questions? cde@christianacare.org