Hi to everyone , i have a challenge right now in python that for now needs a bit of help in one part of the c0de.
The task is create a new file with the name of the file defined by the ASCII content between the 3 byte and the 16 byte that is parsed from the binary file, the file is over 20 Mb i need to create a file for each record ( each record contains the len of 820 ), so right now i know how to read it and do something with it, like :
Now the problem is , how do i get the name file that i want that is the string between the 2 byte and the 16 byte and how to save every 820 bytes to a new file like :
Code:
#attention noob code coming for quick understading i have a for loop for #example not for use i have to use it for the each 820 bytes new file
#with the read of the 820 bytes on the new file and save it and go for the
#next 820 bytes and so on until the end of the file.
for f.read(820) in file:
if f.read() = 820:
a = f.read()
b = open("Iam_from_2_to_16_byte_string", w)
b.write(a)
b.close
---------- Post updated 30-11-12 at 10:26 AM ---------- Previous update was 29-11-12 at 10:42 AM ----------
here is the solution :
Code:
n = 820
with open('/home/drdos/work/file.PDA', "rb") as f:
while True:
data = f.read(n)
if not data:
break
filename = str(data[16:32])
x = open(filename, 'wb').write(data)
#!/bin/bash
i=0
cat 1.csv | while read fileline
do
echo "$fileline"
IFS="#" flds=( $fileline )
nrofflds=${#flds}
echo "noof fields$nrofflds"
fld=0
while
do
echo "noof counter$fld"
echo "$nrofflds"
#fld1="${flds}" trying to store the content of line to fields but i... (4 Replies)
Hi Guys,
I am new to unix scripting and I am tasked to parse through a CSV file delimited by #.
Sample:
sample.csv
H#A#B#C
D#A#B#C
T#A#B#C
H = Header
D = Detail Record
T = Tail
What I need is to read the file and parse through it to get the columns.
I have no idea on how... (8 Replies)
Hi,
I am working on the script to parsing the specific message like "aaaa" in multiple log files like N1-***,N2-***,N3-***...
The script is to find the list of lof files which contains the message "aaaa" and export the list into excel filE.
Can anyone give help?
Thanks (2 Replies)
This is part of my script, as you can see when the alarm is raised it shows some text, what I need it to do is to actually kill the binary "test" (TEST_PATH) when the timeout happens.
#!/usr/bin/python26
from optparse import OptionParser
import nagios
import re
import subprocess... (0 Replies)
Well, that's what I'd do in bash :) Here's what I have so far:
import urllib2
from BeautifulSoup import BeautifulStoneSoup
xml = urllib2.urlopen('http://weatherlink.com/xml.php?user=blah&pass=blah')
soup = BeautifulStoneSoup(xml)
print soup.prettify()
but all it does is grab the html... (0 Replies)
Hi..Can anyone suggest a simple way of achieving this. I have several files which ends with extension .vcf . I will give example with two files
In the below files, we are interested in
File 1:
38 107 C 3 T 6 C/T
38 241 C 4 T 5 C/T
38 247 T 4 C 5 T/C
38 259 T 3 C 6 T/C... (8 Replies)
Hello to all in forum,
Please your help with this.
I have a binary file that is represented in Binary or Binary Coded Decimal (BCD).
Do you know a parser for this kind of binary files?
I have the structure format, but I don't know how and where to begin.
You answer would be very... (15 Replies)
Hi,
I am not a C programmer. The only C exposure I have is reading and completing the exercises from the C (ANSI C ) Programming Language book:o
At the moment, I am using the UNIX strings command to extract information for a binary file and grepping for a particular string and the value... (3 Replies)
I am working on requirement on spreadsheet in python scripting.
I have a spreadsheet containing cell values and with background color.
I am able to read the value value but unable to get the background color of that particular cell.
Actually my requirement is to read the cell value along... (1 Reply)
more data.txt
user1:psw1:Moni,Admi
user2:psw2:Depl,Moni,Admi
I wish to perform the following task on the data.txt in my python script
1. read line by line data.txt
2. Once you read the first line split it using delimiter ":" i.e "user1" "psw1" & "Moni,Admi"
3. split the 3rd string i.e... (4 Replies)
Discussion started by: mohtashims
4 Replies
LEARN ABOUT DEBIAN
metasys
METASYS(8) NUT Manual METASYS(8)NAME
metasys - Driver for Meta System UPS equipment
NOTE
This man page only documents the hardware-specific features of the metasys driver. For information about the core driver, see nutupsdrv(8).
SUPPORTED HARDWARE
The metasys driver was written with the "Meta System UPS Protocol Rev.1.12" kindly supplied from Meta System.
The driver should support all the common features of the ups models:
o HF Line (/2) 1-8 boards
o HF Millennium (810, 820)
o HF TOP Line (910, 920, 930, 940, 950, 970, 980)
o ECO Network (750, 1000, 1050, 1500, 1800, 2000, 2100, 2500, 3000)
o ECO (305, 308, 311, 511, 516, 519, 522, SX, SXI)
o ally HF (800, 1000, 1250, 1600, 2000, 2500)
o Megaline (1250, 2500, 3750, 5000, 6250, 7500, 8750, 10000)
CABLING
The needed cable is a standard pin-to-pin serial cable with at least pins 2, 3, and 5 (on DB9 connector) connected.
EXTRA ARGUMENTS
This driver supports no extra arguments from ups.conf(5).
BUGS
This driver has been tested on Meta System HF Millennium 820 and ally HF 1000 only.
Any information about the use of the driver with the other listed UPS are really welcome.
AUTHOR
Fabio Di Niro <blaxwan@users.sourceforge.net>
SEE ALSO
The core driver:
nutupsdrv(8)
Internet resources:
The NUT (Network UPS Tools) home page: http://www.networkupstools.org/
Network UPS Tools 05/21/2012 METASYS(8)