Skip to main content
Became Hot Network Question
removed linux tag and improved formatting
Source Link

I have a CSV file that contains usernames and passwords. The file looks something like this:

user1,password1
user2,password2
user3,password3

user1,password1
user2,password2
user3,password3

I need to loop through each line to grab the username and password, use those variables, and then grab the next set of usernames and passwords, replace the content of the variables with the new ones, etc.

I've been searching for the best way to do this, but I'm not very familiar scripting and I'm getting lost. I've used awkawk to grab both individually, but I'm struggling to figure out how to use awkawk within a while loop. And I'm reading that might not be a great approach. Any help that coudl be provided would be appreciated.

I have a CSV file that contains usernames and passwords. The file looks something like this:

user1,password1
user2,password2
user3,password3

I need to loop through each line to grab the username and password, use those variables, and then grab the next set of usernames and passwords, replace the content of the variables with the new ones, etc.

I've been searching for the best way to do this, but I'm not very familiar scripting and I'm getting lost. I've used awk to grab both individually, but I'm struggling to figure out how to use awk within a while loop. And I'm reading that might not be a great approach. Any help that coudl be provided would be appreciated.

I have a CSV file that contains usernames and passwords. The file looks something like this:

user1,password1
user2,password2
user3,password3

I need to loop through each line to grab the username and password, use those variables, and then grab the next set of usernames and passwords, replace the content of the variables with the new ones, etc.

I've been searching for the best way to do this, but I'm not very familiar scripting and I'm getting lost. I've used awk to grab both individually, but I'm struggling to figure out how to use awk within a while loop. And I'm reading that might not be a great approach.

Source Link

How to loop through a CSV with multiple lines to grab 2 variables?

I have a CSV file that contains usernames and passwords. The file looks something like this:

user1,password1
user2,password2
user3,password3

I need to loop through each line to grab the username and password, use those variables, and then grab the next set of usernames and passwords, replace the content of the variables with the new ones, etc.

I've been searching for the best way to do this, but I'm not very familiar scripting and I'm getting lost. I've used awk to grab both individually, but I'm struggling to figure out how to use awk within a while loop. And I'm reading that might not be a great approach. Any help that coudl be provided would be appreciated.