I have a .txt file like this image for txt file, where every column can be classified as UserName:ReferenceToThePassowrd:UserID:GroupID:UserIDInfo:HomeDir:LoginShell
.
I want to make a script to parse the file and generate a list of dictionaries where each user information is represented by a single dictionary:
Here is an example of how the final output should look like:
[
{
"user_name": "user1",
"user_id": "1001",
"home_dir": "/home/user1",
"login_shell": "/bin/bash"
},
{
"user_name": "user2",
"user_id": "1002",
"home_dir": "/home/user2",
"login_shell": "/bin/bash"
}
]