Need a Python Script asap


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need a Python Script asap
# 1  
Old 11-27-2012
Need a Python Script asap

I work on various messages received from server and want to write a python script that can sort messages with unique flag values and give me the output in a text file.

I get these messages in the form of .zcap file from server and I use an internal tool to filter:
Step 1) Zcap file to get security types,
Step 2) then filter each security types file that generate various exchanges files
Steps 3) lastly filter each exchange files to get message types files.

For eg: I filtered a .zcap file to get message types as -
BOND-----CVE----- MTR_BOND, MTFD_BOND, MTQ_BQUOTE, MTQ_MBBOQUOTE
BOND-----NYSE---- MTR_BOND, MTFD_BOND, MTQ_BQUOTE
BOND-----TSE--- MTR_BOND, MTFD_BOND, MTA_RECAP, MTT_TRADE, MTT_STATUS, MTA_CLOSE

Step 4) at present, I run a UNIX command on each message type that generates multiple text files of each unique flag value messages (for eg; MTR_BOND).
$ awk '/MTQ/,/Quote Condition/{a[i++]=$0;if($0~/Flags:/){sub(":","",$2);fname=$2}if($0~/Quote Condition/){for(j=0;j<=i;j++)print a[j] > fname;i=0}}' MTA.txt

This is a very tedious job to run this command on each message type file (for eg; MTR_BOND) level, I want a python script that I run at Security Type level (for eg; BOND) .
Here I attach text file for BOND and its exchanges and message types. Please write a python script (preferably) to generate 1 text file for each message types with only 1 message of unique flag value.
# 2  
Old 11-27-2012
Everyone at the UNIX and Linux Forums gives their best effort to reply to all questions in a timely manner. For this reason, posting questions with subjects like "Urgent!" or "Emergency" and demanding a fast reply are not permitted in the regular forums.

For members who want a higher visibility to their questions, we suggest you post in the Emergency UNIX and Linux Support Forum. This forum is given a higher priority than our regular forums.

Posting a new question in the Emergency UNIX and Linux Support Forum requires forum Bits. We monitor this forum to help people with emergencies, but we do not not guarantee response time or best answers. However, we will treat your post with a higher priority and give our best efforts to help you.

If you have posted a question in the regular forum with a subject "Urgent" "Emergency" or similar idea, we will, more-than-likely, close your thread and post this reply, redirecting you to the proper forum.

Of course, you can always post a descriptive subject text, remove words like "Urgent" etc. (from your subject and post) and post in the regular forums at any time.

Also your first post will be reviewed by our moderation team. Please don't open a new thread before you hear from us.


Thank you.

The UNIX and Linux Forums
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

How to execute python script on remote with python way..?

Hi all, I am trying to run below python code for connecting remote windows machine from unix to run an python file exist on that remote windows machine.. Below is the code I am trying: #!/usr/bin/env python import wmi c = wmi.WMI("xxxxx", user="xxxx", password="xxxxxxx")... (1 Reply)
Discussion started by: onenessboy
1 Replies

2. Shell Programming and Scripting

Capture run time of python script executed inside shell script

I have bash shell script which is internally calling python script.I would like to know how long python is taking to execute.I am not allowed to do changes in python script.Please note i need to know execution time of python script which is getting executed inside shell .I need to store execution... (2 Replies)
Discussion started by: Adfire
2 Replies

3. Homework & Coursework Questions

PLEASE HELP ME ASAP

can anyone help me with this??? make program ( shell script) to detect and display errors occurred in initializing a Unix system (4 Replies)
Discussion started by: dementor
4 Replies

4. Shell Programming and Scripting

Need help to write a shell script ASAP

Hi, 1) Need help to write script in KSH to detect a duplicate file. 2) The original file needs to be moved from current path to a different path 3) The duplicate file should continue to stay in the same path. Exact file names & duplicate file names are given below. Please help me at the... (7 Replies)
Discussion started by: bhagya3001
7 Replies

5. Shell Programming and Scripting

need help asap!

Hello everyone, I'm new to using Linux and i am trying to create a script that will produce a list of all the files of the present working directory. So far I only have this #!/bin/bash cd / ls -lt>> I can't figure out what I am suppose to do next. (6 Replies)
Discussion started by: reecygee
6 Replies

6. Shell Programming and Scripting

need help asap

i have a file having content a|b|c 1|2|33 4|6|55 end a|b|d 3|4|55 end a|b|c 45|67|98 end so i want to print 3rd field of header a|b|c and footer end. e.g. o/p should be 33 55 98 (7 Replies)
Discussion started by: manas_ranjan
7 Replies

7. Shell Programming and Scripting

UNIX script problem ..Plz help ASAP

Hi folks, I have written down a UNIX script which actually FTP the file to other server. What is happening now , this script is not working only for 1 server , as it is working for 32 different FTP server . In this particular server , we are getting message “FTp:550 access denied”... (1 Reply)
Discussion started by: khan1978
1 Replies

8. UNIX for Dummies Questions & Answers

I Need Some (help)answers Asap

can someone explain the meaning of the following shell commands: 1. who / wc -l 2. who / sort > user_names 3. cat students > new_students 4. current_day='date / cut -cl-3' i would also appreciated if you could tell me some things about the umask 1. what is a good umask value and why? 2.... (2 Replies)
Discussion started by: dakis
2 Replies

9. UNIX for Dummies Questions & Answers

Sendmail - need help ASAP

Hi guys ! I have 24 hours to learn about sendmail (as much as I can) ... where to start ? where to go ? thnx, (2 Replies)
Discussion started by: Gismo
2 Replies

10. Shell Programming and Scripting

Need rm script help ASAP

I need your expertise anyone. I'm trying to remove part of a id # in a script. Reason, the part of the id is a underscore that is making my life impossible. I simply cannot handle all the requests and modify every single one in vi or edt. So I wanted to modify the script.. For example ... (12 Replies)
Discussion started by: simon2000
12 Replies
Login or Register to Ask a Question