Read .txt each line stream and REPLACE string values separated by [,] comma












0















I am fairly new to C# Here I want to get the contents of List.txt and replace the GUID and Password from the list. The objective here is to replace the GUID and PASSWORD from each each line from the file List.txt
List Format:



 Simpletest@humnianmai.com,Funkie312 
Monkeies241@kubkdaw.com,Knuanh141
Nuimabaiu@hgsa.gtv,jUbskj371


NOTE: I encrypt the data but this is just an example.



public class Log
{
private const string UserList = @"C:ServerUserManagementlist.txt";
string contents = File.ReadLines(GUID);
string contents = File.ReadLines(PASSWORD);


private static readonly string URL = "https://www.mypersonaldomain.com/account/verify?guid=" + GUID + "&" + PASSWORD;


Update from comments




I need to take the contents list from the file List.txt and replace
that in the




private static readonly string URL = "https://www.mypersonaldomain.com/account/verify?guid=" + GUID + "&" + PASSWORD;



I only need to replace GUID and PASSWORD but I do not know
how to tell the code to read from the file and GUID,PASSWORD is
seperated like Monkeies241@kubkdaw.com,Knuanh141 in the List.txt











share|improve this question




















  • 2





    Can you make this a little clearer, its not obvious what is in the lists, the files, and what you want to replace

    – Michael Randall
    Nov 24 '18 at 6:41











  • Revised.//10char

    – Ryan Smith
    Nov 24 '18 at 7:01






  • 2





    Your revisions didn't help one little bit. This is still extremely unclear, If you really wan people to help you, spend more than 10 seconds writing a question, be clear, explain what you want precisely to an audience who have no idea what your application is trying to do, show us what is not working, why you expect it to work, how you come up that logic, what you have tried.

    – Michael Randall
    Nov 24 '18 at 7:07











  • I need to take the contents list from the file List.txt and replace that in the private static readonly string URL = "https://www.mypersonaldomain.com/account/verify?guid=" + GUID + "&" + PASSWORD; I only need to replace GUID and PASSWORD but I do not know how to tell the code to read from the file and GUID,PASSWORD is seperated like Monkeies241@kubkdaw.com,Knuanh141 in the List.txt

    – Ryan Smith
    Nov 24 '18 at 7:22













  • Write the description from your last comment to the question. And must it be a code? For such a simple task I would use text editor with support of regex, e.g. Notepad2.

    – Julo
    Nov 24 '18 at 7:24
















0















I am fairly new to C# Here I want to get the contents of List.txt and replace the GUID and Password from the list. The objective here is to replace the GUID and PASSWORD from each each line from the file List.txt
List Format:



 Simpletest@humnianmai.com,Funkie312 
Monkeies241@kubkdaw.com,Knuanh141
Nuimabaiu@hgsa.gtv,jUbskj371


NOTE: I encrypt the data but this is just an example.



public class Log
{
private const string UserList = @"C:ServerUserManagementlist.txt";
string contents = File.ReadLines(GUID);
string contents = File.ReadLines(PASSWORD);


private static readonly string URL = "https://www.mypersonaldomain.com/account/verify?guid=" + GUID + "&" + PASSWORD;


Update from comments




I need to take the contents list from the file List.txt and replace
that in the




private static readonly string URL = "https://www.mypersonaldomain.com/account/verify?guid=" + GUID + "&" + PASSWORD;



I only need to replace GUID and PASSWORD but I do not know
how to tell the code to read from the file and GUID,PASSWORD is
seperated like Monkeies241@kubkdaw.com,Knuanh141 in the List.txt











share|improve this question




















  • 2





    Can you make this a little clearer, its not obvious what is in the lists, the files, and what you want to replace

    – Michael Randall
    Nov 24 '18 at 6:41











  • Revised.//10char

    – Ryan Smith
    Nov 24 '18 at 7:01






  • 2





    Your revisions didn't help one little bit. This is still extremely unclear, If you really wan people to help you, spend more than 10 seconds writing a question, be clear, explain what you want precisely to an audience who have no idea what your application is trying to do, show us what is not working, why you expect it to work, how you come up that logic, what you have tried.

    – Michael Randall
    Nov 24 '18 at 7:07











  • I need to take the contents list from the file List.txt and replace that in the private static readonly string URL = "https://www.mypersonaldomain.com/account/verify?guid=" + GUID + "&" + PASSWORD; I only need to replace GUID and PASSWORD but I do not know how to tell the code to read from the file and GUID,PASSWORD is seperated like Monkeies241@kubkdaw.com,Knuanh141 in the List.txt

    – Ryan Smith
    Nov 24 '18 at 7:22













  • Write the description from your last comment to the question. And must it be a code? For such a simple task I would use text editor with support of regex, e.g. Notepad2.

    – Julo
    Nov 24 '18 at 7:24














0












0








0








I am fairly new to C# Here I want to get the contents of List.txt and replace the GUID and Password from the list. The objective here is to replace the GUID and PASSWORD from each each line from the file List.txt
List Format:



 Simpletest@humnianmai.com,Funkie312 
Monkeies241@kubkdaw.com,Knuanh141
Nuimabaiu@hgsa.gtv,jUbskj371


NOTE: I encrypt the data but this is just an example.



public class Log
{
private const string UserList = @"C:ServerUserManagementlist.txt";
string contents = File.ReadLines(GUID);
string contents = File.ReadLines(PASSWORD);


private static readonly string URL = "https://www.mypersonaldomain.com/account/verify?guid=" + GUID + "&" + PASSWORD;


Update from comments




I need to take the contents list from the file List.txt and replace
that in the




private static readonly string URL = "https://www.mypersonaldomain.com/account/verify?guid=" + GUID + "&" + PASSWORD;



I only need to replace GUID and PASSWORD but I do not know
how to tell the code to read from the file and GUID,PASSWORD is
seperated like Monkeies241@kubkdaw.com,Knuanh141 in the List.txt











share|improve this question
















I am fairly new to C# Here I want to get the contents of List.txt and replace the GUID and Password from the list. The objective here is to replace the GUID and PASSWORD from each each line from the file List.txt
List Format:



 Simpletest@humnianmai.com,Funkie312 
Monkeies241@kubkdaw.com,Knuanh141
Nuimabaiu@hgsa.gtv,jUbskj371


NOTE: I encrypt the data but this is just an example.



public class Log
{
private const string UserList = @"C:ServerUserManagementlist.txt";
string contents = File.ReadLines(GUID);
string contents = File.ReadLines(PASSWORD);


private static readonly string URL = "https://www.mypersonaldomain.com/account/verify?guid=" + GUID + "&" + PASSWORD;


Update from comments




I need to take the contents list from the file List.txt and replace
that in the




private static readonly string URL = "https://www.mypersonaldomain.com/account/verify?guid=" + GUID + "&" + PASSWORD;



I only need to replace GUID and PASSWORD but I do not know
how to tell the code to read from the file and GUID,PASSWORD is
seperated like Monkeies241@kubkdaw.com,Knuanh141 in the List.txt








c# string filestream console.readline






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 7:36









Michael Randall

32.4k63565




32.4k63565










asked Nov 24 '18 at 6:35









Ryan SmithRyan Smith

126




126








  • 2





    Can you make this a little clearer, its not obvious what is in the lists, the files, and what you want to replace

    – Michael Randall
    Nov 24 '18 at 6:41











  • Revised.//10char

    – Ryan Smith
    Nov 24 '18 at 7:01






  • 2





    Your revisions didn't help one little bit. This is still extremely unclear, If you really wan people to help you, spend more than 10 seconds writing a question, be clear, explain what you want precisely to an audience who have no idea what your application is trying to do, show us what is not working, why you expect it to work, how you come up that logic, what you have tried.

    – Michael Randall
    Nov 24 '18 at 7:07











  • I need to take the contents list from the file List.txt and replace that in the private static readonly string URL = "https://www.mypersonaldomain.com/account/verify?guid=" + GUID + "&" + PASSWORD; I only need to replace GUID and PASSWORD but I do not know how to tell the code to read from the file and GUID,PASSWORD is seperated like Monkeies241@kubkdaw.com,Knuanh141 in the List.txt

    – Ryan Smith
    Nov 24 '18 at 7:22













  • Write the description from your last comment to the question. And must it be a code? For such a simple task I would use text editor with support of regex, e.g. Notepad2.

    – Julo
    Nov 24 '18 at 7:24














  • 2





    Can you make this a little clearer, its not obvious what is in the lists, the files, and what you want to replace

    – Michael Randall
    Nov 24 '18 at 6:41











  • Revised.//10char

    – Ryan Smith
    Nov 24 '18 at 7:01






  • 2





    Your revisions didn't help one little bit. This is still extremely unclear, If you really wan people to help you, spend more than 10 seconds writing a question, be clear, explain what you want precisely to an audience who have no idea what your application is trying to do, show us what is not working, why you expect it to work, how you come up that logic, what you have tried.

    – Michael Randall
    Nov 24 '18 at 7:07











  • I need to take the contents list from the file List.txt and replace that in the private static readonly string URL = "https://www.mypersonaldomain.com/account/verify?guid=" + GUID + "&" + PASSWORD; I only need to replace GUID and PASSWORD but I do not know how to tell the code to read from the file and GUID,PASSWORD is seperated like Monkeies241@kubkdaw.com,Knuanh141 in the List.txt

    – Ryan Smith
    Nov 24 '18 at 7:22













  • Write the description from your last comment to the question. And must it be a code? For such a simple task I would use text editor with support of regex, e.g. Notepad2.

    – Julo
    Nov 24 '18 at 7:24








2




2





Can you make this a little clearer, its not obvious what is in the lists, the files, and what you want to replace

– Michael Randall
Nov 24 '18 at 6:41





Can you make this a little clearer, its not obvious what is in the lists, the files, and what you want to replace

– Michael Randall
Nov 24 '18 at 6:41













Revised.//10char

– Ryan Smith
Nov 24 '18 at 7:01





Revised.//10char

– Ryan Smith
Nov 24 '18 at 7:01




2




2





Your revisions didn't help one little bit. This is still extremely unclear, If you really wan people to help you, spend more than 10 seconds writing a question, be clear, explain what you want precisely to an audience who have no idea what your application is trying to do, show us what is not working, why you expect it to work, how you come up that logic, what you have tried.

– Michael Randall
Nov 24 '18 at 7:07





Your revisions didn't help one little bit. This is still extremely unclear, If you really wan people to help you, spend more than 10 seconds writing a question, be clear, explain what you want precisely to an audience who have no idea what your application is trying to do, show us what is not working, why you expect it to work, how you come up that logic, what you have tried.

– Michael Randall
Nov 24 '18 at 7:07













I need to take the contents list from the file List.txt and replace that in the private static readonly string URL = "https://www.mypersonaldomain.com/account/verify?guid=" + GUID + "&" + PASSWORD; I only need to replace GUID and PASSWORD but I do not know how to tell the code to read from the file and GUID,PASSWORD is seperated like Monkeies241@kubkdaw.com,Knuanh141 in the List.txt

– Ryan Smith
Nov 24 '18 at 7:22







I need to take the contents list from the file List.txt and replace that in the private static readonly string URL = "https://www.mypersonaldomain.com/account/verify?guid=" + GUID + "&" + PASSWORD; I only need to replace GUID and PASSWORD but I do not know how to tell the code to read from the file and GUID,PASSWORD is seperated like Monkeies241@kubkdaw.com,Knuanh141 in the List.txt

– Ryan Smith
Nov 24 '18 at 7:22















Write the description from your last comment to the question. And must it be a code? For such a simple task I would use text editor with support of regex, e.g. Notepad2.

– Julo
Nov 24 '18 at 7:24





Write the description from your last comment to the question. And must it be a code? For such a simple task I would use text editor with support of regex, e.g. Notepad2.

– Julo
Nov 24 '18 at 7:24












1 Answer
1






active

oldest

votes


















0














var lines = File.ReadLines("List.txt")
.Select(x =>
{
var split = x.Split(',');
return $"https://www.mypersonaldomain.com/account/verify?guid={split[0]}&{split[1]}";
});




Additional Resources



String.Split Method




Returns a string array that contains the substrings in this instance
that are delimited by elements of a specified string or Unicode
character array.




Enumerable.Select Method




Projects each element of a sequence into a new form.




$ - string interpolation (C# Reference)




The $ special character identifies a string literal as an interpolated
string. An interpolated string is a string literal that might contain
interpolated expressions. When an interpolated string is resolved to a
result string, items with interpolated expressions are replaced by the
string representations of the expression results. This feature is
available in C# 6 and later versions of the language.







share|improve this answer
























  • I added your code...this does not replace anything and left out password... I checked with Fiddler my packet-sent look like this mypersonaldomain.com/account/verify?guid=& and I receive invalid response. Please help.

    – Ryan Smith
    Nov 24 '18 at 8:00













  • @RyanSmith the code is fine, your debugging skills are not though Tutorial: Learn to debug using Visual Studio put a break point on the split and also inspect lines. afterwards

    – Michael Randall
    Nov 24 '18 at 8:03













  • you wrote var but I am using string for GUID and PASSWORD I am confused about how to fit your code with public static string GUID; public static string PASSWORD; and url

    – Ryan Smith
    Nov 24 '18 at 8:40











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53455789%2fread-txt-each-line-stream-and-replace-string-values-separated-by-comma%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














var lines = File.ReadLines("List.txt")
.Select(x =>
{
var split = x.Split(',');
return $"https://www.mypersonaldomain.com/account/verify?guid={split[0]}&{split[1]}";
});




Additional Resources



String.Split Method




Returns a string array that contains the substrings in this instance
that are delimited by elements of a specified string or Unicode
character array.




Enumerable.Select Method




Projects each element of a sequence into a new form.




$ - string interpolation (C# Reference)




The $ special character identifies a string literal as an interpolated
string. An interpolated string is a string literal that might contain
interpolated expressions. When an interpolated string is resolved to a
result string, items with interpolated expressions are replaced by the
string representations of the expression results. This feature is
available in C# 6 and later versions of the language.







share|improve this answer
























  • I added your code...this does not replace anything and left out password... I checked with Fiddler my packet-sent look like this mypersonaldomain.com/account/verify?guid=& and I receive invalid response. Please help.

    – Ryan Smith
    Nov 24 '18 at 8:00













  • @RyanSmith the code is fine, your debugging skills are not though Tutorial: Learn to debug using Visual Studio put a break point on the split and also inspect lines. afterwards

    – Michael Randall
    Nov 24 '18 at 8:03













  • you wrote var but I am using string for GUID and PASSWORD I am confused about how to fit your code with public static string GUID; public static string PASSWORD; and url

    – Ryan Smith
    Nov 24 '18 at 8:40
















0














var lines = File.ReadLines("List.txt")
.Select(x =>
{
var split = x.Split(',');
return $"https://www.mypersonaldomain.com/account/verify?guid={split[0]}&{split[1]}";
});




Additional Resources



String.Split Method




Returns a string array that contains the substrings in this instance
that are delimited by elements of a specified string or Unicode
character array.




Enumerable.Select Method




Projects each element of a sequence into a new form.




$ - string interpolation (C# Reference)




The $ special character identifies a string literal as an interpolated
string. An interpolated string is a string literal that might contain
interpolated expressions. When an interpolated string is resolved to a
result string, items with interpolated expressions are replaced by the
string representations of the expression results. This feature is
available in C# 6 and later versions of the language.







share|improve this answer
























  • I added your code...this does not replace anything and left out password... I checked with Fiddler my packet-sent look like this mypersonaldomain.com/account/verify?guid=& and I receive invalid response. Please help.

    – Ryan Smith
    Nov 24 '18 at 8:00













  • @RyanSmith the code is fine, your debugging skills are not though Tutorial: Learn to debug using Visual Studio put a break point on the split and also inspect lines. afterwards

    – Michael Randall
    Nov 24 '18 at 8:03













  • you wrote var but I am using string for GUID and PASSWORD I am confused about how to fit your code with public static string GUID; public static string PASSWORD; and url

    – Ryan Smith
    Nov 24 '18 at 8:40














0












0








0







var lines = File.ReadLines("List.txt")
.Select(x =>
{
var split = x.Split(',');
return $"https://www.mypersonaldomain.com/account/verify?guid={split[0]}&{split[1]}";
});




Additional Resources



String.Split Method




Returns a string array that contains the substrings in this instance
that are delimited by elements of a specified string or Unicode
character array.




Enumerable.Select Method




Projects each element of a sequence into a new form.




$ - string interpolation (C# Reference)




The $ special character identifies a string literal as an interpolated
string. An interpolated string is a string literal that might contain
interpolated expressions. When an interpolated string is resolved to a
result string, items with interpolated expressions are replaced by the
string representations of the expression results. This feature is
available in C# 6 and later versions of the language.







share|improve this answer













var lines = File.ReadLines("List.txt")
.Select(x =>
{
var split = x.Split(',');
return $"https://www.mypersonaldomain.com/account/verify?guid={split[0]}&{split[1]}";
});




Additional Resources



String.Split Method




Returns a string array that contains the substrings in this instance
that are delimited by elements of a specified string or Unicode
character array.




Enumerable.Select Method




Projects each element of a sequence into a new form.




$ - string interpolation (C# Reference)




The $ special character identifies a string literal as an interpolated
string. An interpolated string is a string literal that might contain
interpolated expressions. When an interpolated string is resolved to a
result string, items with interpolated expressions are replaced by the
string representations of the expression results. This feature is
available in C# 6 and later versions of the language.








share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 24 '18 at 7:28









Michael RandallMichael Randall

32.4k63565




32.4k63565













  • I added your code...this does not replace anything and left out password... I checked with Fiddler my packet-sent look like this mypersonaldomain.com/account/verify?guid=& and I receive invalid response. Please help.

    – Ryan Smith
    Nov 24 '18 at 8:00













  • @RyanSmith the code is fine, your debugging skills are not though Tutorial: Learn to debug using Visual Studio put a break point on the split and also inspect lines. afterwards

    – Michael Randall
    Nov 24 '18 at 8:03













  • you wrote var but I am using string for GUID and PASSWORD I am confused about how to fit your code with public static string GUID; public static string PASSWORD; and url

    – Ryan Smith
    Nov 24 '18 at 8:40



















  • I added your code...this does not replace anything and left out password... I checked with Fiddler my packet-sent look like this mypersonaldomain.com/account/verify?guid=& and I receive invalid response. Please help.

    – Ryan Smith
    Nov 24 '18 at 8:00













  • @RyanSmith the code is fine, your debugging skills are not though Tutorial: Learn to debug using Visual Studio put a break point on the split and also inspect lines. afterwards

    – Michael Randall
    Nov 24 '18 at 8:03













  • you wrote var but I am using string for GUID and PASSWORD I am confused about how to fit your code with public static string GUID; public static string PASSWORD; and url

    – Ryan Smith
    Nov 24 '18 at 8:40

















I added your code...this does not replace anything and left out password... I checked with Fiddler my packet-sent look like this mypersonaldomain.com/account/verify?guid=& and I receive invalid response. Please help.

– Ryan Smith
Nov 24 '18 at 8:00







I added your code...this does not replace anything and left out password... I checked with Fiddler my packet-sent look like this mypersonaldomain.com/account/verify?guid=& and I receive invalid response. Please help.

– Ryan Smith
Nov 24 '18 at 8:00















@RyanSmith the code is fine, your debugging skills are not though Tutorial: Learn to debug using Visual Studio put a break point on the split and also inspect lines. afterwards

– Michael Randall
Nov 24 '18 at 8:03







@RyanSmith the code is fine, your debugging skills are not though Tutorial: Learn to debug using Visual Studio put a break point on the split and also inspect lines. afterwards

– Michael Randall
Nov 24 '18 at 8:03















you wrote var but I am using string for GUID and PASSWORD I am confused about how to fit your code with public static string GUID; public static string PASSWORD; and url

– Ryan Smith
Nov 24 '18 at 8:40





you wrote var but I am using string for GUID and PASSWORD I am confused about how to fit your code with public static string GUID; public static string PASSWORD; and url

– Ryan Smith
Nov 24 '18 at 8:40




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53455789%2fread-txt-each-line-stream-and-replace-string-values-separated-by-comma%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Wiesbaden

Marschland

Dieringhausen