Created
March 20, 2018 06:49
-
-
Save kaku87/d4f82fe8928ada57dfb00be1707f0f4a to your computer and use it in GitHub Desktop.
file replace
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
#!/bin/bash | |
python | |
filetosearch = '/home/ubuntu/ip_table.txt' | |
texttoreplace = 'tcp443' | |
texttoinsert = 'udp1194' | |
s = open(filetosearch).read() | |
s = s.replace(texttoreplace, texttoinsert) | |
f = open(filetosearch, 'w') | |
f.write(s) | |
f.close() | |
quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment