This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convertCSVtoJSON(input): #pass the name of the input csv file | |
f = open(input, 'r') | |
j = open('.tempJSON', 'w') | |
fieldnames = ("field1,field2,field3") | |
reader = csv.DictReader(f, fieldnames) | |
for row in reader: | |
json.dump(row, j) | |
j.write('\n') | |
f.close() | |
j.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/expect -f | |
set username [lrange $argv 0 0] | |
set host [lrange $argv 1 1] | |
set password [lrange $argv 2 2] | |
set timeout -1 | |
spawn ssh $username@$host | |
expect "*?assword:*" | |
send -- "$password\r" | |
send -- "\r" |