How to use regex (re)
piseema at gmail.com
Thu Aug 6 22:06:36 CEST 2015
I have a following script which extracts xyz.tgz and outputs to a folder which contains several sub-folders and files.
source_dir = "c:\\TEST"
dest_dir = "c:\\TEST"
for src_name in glob.glob(os.path.join(source_dir, '*.tgz')):
base = os.path.basename(src_name)
dest_name = os.path.join(dest_dir, base[:-4])
with tarfile.open(src_name, 'r') as infile:
When above script is ran, the output is a single directory within that directory the structure looks like this:
In these folder, there are sub-folders and files. Among those file there are some data i am interested in to search and output to a file.
For eg. Among the folders there is a file called **'localcli_network-ip-neighbor-list.txt**' which contains IP address(s) which I would like to output to a file.
More information about the Python-list