I have a .txt file that looks like something like this:
<Location /git>
AuthType Basic
AuthName "Please enter your CVC username and password."
AuthBasicProvider LOCAL_authfile LDAP_CVCLAB LDAP_CVC007
AuthGroupFile /data/conf/git_group
#Require valid-user
Require group admins
Require group m4rtcdd
</Location>
# TEST
# SPACE
<Location /git/industry2go>
AuthType Basic
AuthName "Please enter your CVC username and password."
AuthBasicProvider LOCAL_authfile LDAP_CVCLAB LDAP_CVC007
AuthGroupFile /data/conf/git_group
#Require valid-user
Require group admins
Require group space_mobile_app
</Location>
<Location /git/sales2go-core>
AuthType Basic
AuthName "Please enter your CVC username and password."
AuthBasicProvider LOCAL_authfile LDAP_CVCLAB LDAP_CVC007
AuthGroupFile /data/conf/git_group
#Require valid-user
Require group admins
Require group space_mobile_app
</Location>
I need to make from this file a .xlsx file that needs to look like this:
So basicly what should happen:
in the column name "groupName" should be group names that are taken from: "Require group admins, "Reguire group m4rtcdd"
in the column name "repoName" should pe the repository name that is taken from: "<Location /git> that means "/" (root) or for another example "<Location/git/industry2go> where "industry2go" its the "RepoName""
This is my script for the momement:
import pandas as pd
from svnscripts.timestampdirectory import createdir,path_dir
import time
import os
def gitrepoaccess():
timestr = time.strftime("%Y-%m-%d")
pathdest = path_dir()
df = pd.read_csv(rf"{pathdest}\{timestr}-rawGitData-conf.bck.txt",sep=';',lineterminator='\n',header=None)
#this is the drop of 0-32 line because was a big chunk file
df=df.drop(df.index[range(0,32)])
dest=createdir()
df.to_excel(os.path.join(dest, "GitRepoGroupAccess.xlsx"), index=False)
print(df)
gitrepoaccess()
I tried to use the delimiter but its not work cause also the "admins" category appears always and need to be displayed only once at the begining, as you can se in the raw.txt file its appearing in each "repository name".
