Posted: 14 May 2019 1:02 EDT Last activity: 14 May 2019 16:47 EDT
reading file in Unix and store it's contents using lookup table
Hi , I have a assignment where I need to read a text file in Unix server. For this I have written a c sharp script and using winscp methods connecting to Unix server. Also Unix command we can pass as parameter. Post this I have to save the content of this file using lookup table where 2 column will be der (date and data). So could you plz guide me how to do it with examples.
***Edited by Moderator: Lochan to update platform capability tags***
I am not quiet sure what you are asking for. It sounds like you already have the data coming out of your script. Are you asking how to parse the text you are getting back? Can you provide a sample of the text? Typically, text parsing can be done in C# rather easily, but you can also use the string utils if you prefer to do so in an automation. For example;
Assuming your text were delimited in some way, you could use the Split method of the StringUtils and pass that into a ListLoop. You would split on a Newline which you could type into the method. Out of the ListLoop would be one line of data. You could then Split that line on whatever the delimiter is. You could then extract whatever items you needed from the array and call the AddRecord method of your lookup table to get the data in there.
Inside of a C# script you could do the same steps but all inside the script. Instead of adding to a LookupTable though, you'd want to create a DataTable that your script would return. You'd split and add your records to it and then return that DataTable. You could then call ReplaceTable() on your LookupTable and effectively populate it directly.