Well the reqirements here are nothing like your OP!
I noticed that you edited your post what was the edit???
Try this; it CAN be slimmed down. I will let you do that...
Code:
# python 2.7.x
f=open("/Users/barrywalker/data.txt", "r")
for line in f.readlines():
lst=line.split(":")
username=lst[0]
password=lst[1]
groups=lst[2]
print "Username=%s" %(username)
print "Password=%s" %(password)
print "Groups=%s" %(groups)
f.close()
Results:-
Code:
Last login: Wed Sep 21 20:14:55 on ttys000
AMIGA:barrywalker~> cd Desktop/Code/Python
AMIGA:barrywalker~/Desktop/Code/Python> python
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> execfile("lst_test.py")
Username=user1
Password=psw1
Groups=Moni,Admi
Username=user2
Password=psw2
Groups=Depl,Moni,Admi
>>> exit()
AMIGA:barrywalker~/Desktop/Code/Python> _
IMPORTANT NOTE:-
you will be re-using the same variables per line loop!
You will have to intercept each loop to do something with the variables, that is up to you.
EDIT:-
Cure copy and paste in code.
Last edited by wisecracker; 09-21-2016 at 05:05 PM..
This User Gave Thanks to wisecracker For This Post:
Hello
I am trying to run a python program using shell script, which takes a single argument from a file.
This file has one entry per line :
1aaa
2bbb
3ccc
4ddd
5eee
...
...
...
My shell script runs the program, only for the last entry :
#!/bin/sh
IFS=$'\n'
for line in $(cat... (2 Replies)
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... (0 Replies)
Hi all,
I`m trying to generate some plots using a python package named splicegrapher.
I have access to a cluster which does not allow X11 forwarding and as a result I get RuntimeError: could not open display error when I use one of the plotting scripts (attached).
How do I modify the script... (1 Reply)
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)
I'm writing python script to get the file-names in the current directory and file sizes .I'm able to get file list and their sizes but unable to pass them through command line. I want to use this script to execute on other directory and pass directory path with file name through command line. Any... (1 Reply)
so, the first line of bash, perl, python, ruby, and similar languages must contain the path to the interpreter...i.e. #!/bin/perl, or #!/bin/python. so in the case of a perl script, for instance, a perl script cannot and will never run if the perl program is not installed/present on the system. ... (9 Replies)
Team
I have files in different directories . How can i take the count of latest file and insert into Db2 table .
I am using
awk 'END{print NR+1-ARGC}' (File name)
to get the counts.
How can i take
1.The count of latest file
2.Insert into Db2 table( File Name and Counts) .
cd... (4 Replies)
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)
Hello,
I am running under ubuntu 14.04.
I have a python file bringing requested data. When I run, it asks me to enter query info. After that, it gives the data if anything matched can be found.
What I need to accomplish is, instead of entering the requested data from keyboard, to put all... (11 Replies)
Hi Experts,
I am working one one python script in version 3.x and 2.6. Need your support to complete it
Basically for both commands i have telnet to device and run command and then receiving input File 1 and File 2
I have two commands, need to grep data and output in csv file.
Next script/code... (0 Replies)
Discussion started by: as7951
0 Replies
LEARN ABOUT DEBIAN
fence_rackswitch
fence_rackswitch(8) System Manager's Manual fence_rackswitch(8)NAME
fence_rackswitch - I/O Fencing agent for RackSaver RackSwitch
SYNOPSIS
fence_rackswitch [OPTION]...
DESCRIPTION
fence_rackswitch is an I/O Fencing agent which can be used with the RackSaver RackSwitch. It logs into the RackSwitch and boots a speci-
fied plug. Using the http interface to the RackSwitch should be avoided while a GFS cluster is running because the connection may inter-
fere with the operation of this agent.
fence_rackswitch accepts options on the command line as well as from stdin. fenced sends the options through stdin when it execs the
agent. fence_rackswitch can be run by itself with command line options which is useful for testing.
Vendor URL: http://www.bladenetwork.net
OPTIONS -a IPaddress
IP address of the switch.
-h Print out a help message describing available options, then exit.
-n plug
The plug number to power cycle.
-p password
Password for login.
-S path
Full path to an executable to generate the password for login.
-l username
Username for login.
-q Quiet operation. Only print out error messages.
-V Print out a version message, then exit.
STDIN PARAMETERS
agent = < param >
This option is used by fence_node(8) and is ignored by fence_rackswitch.
ipaddr = < ip >
IP address of the switch.
username = < param >
Username for login.
password = < param >
Password for login.
passwd_script = < param >
Full path to an executable to generate the password for login.
port = < param >
The port (outlet) number to act upon.
SEE ALSO fence(8), fence_node(8)fence_rackswitch(8)