I'm a beginner-mid level bash scripter and I'm not very familiar with working with csv files through terminal.
Through the hours of research I've wasted on this, I'm guessing sed or awk will be my best bet, I'm just not certain the best way to accomplish this.
The CSV is as follows:
Owner,id,permission.deleted,permission.displayName,permission.domain,permission.emailAddress,permission.id,permission.photoLink,permission.role,permission.type
[email protected],some_file_id,False,Display Name,domain.com,[email protected],permissionidnumber,,writer,user
[email protected],some_file_id,False,Display Name,domain.com,[email protected],permissionidnumber,url,owner,user
My goal is to remove any lines where the owner is granted permissions from the original csv.
Ideally, I'd like something along the lines of "If Column A (Owner) matches Column F (permission.emailAddress), delete the line"
Desired Output - Replace existing CSV with: The CSV is as follows:
Owner,id,permission.deleted,permission.displayName,permission.domain,permission.emailAddress,permission.id,permission.photoLink,permission.role,permission.type
[email protected],some_file_id,False,Display Name,domain.com,[email protected],permissionidnumber,,writer,user
The command I'm running needs to use the CSV to read the permissions appropriately and I'm removing the owner since they retain ownership and if I try to grant it to them again, they receive an email and I'm trying to avoid spamming my users.
If I can't grab match two columns within the CSV and delete it from there, I can probably grab the [email protected] address and set it to a variable to use if that's easier. I just have to run this against ~100 unique users so the more I can automate, the better.
I'm guessing sed or awk will be my best bet- you are correct about awk.