CSV where clause need to skip the first loop.


 file.writealllines(destination1, file.readalllines(destination).where(l => !l.startswith(@"""name""")));

above code working fine, heading contains "name" need skip heading , remaining fine...

how can achieve above code.


something along line of logic shows how exclude blank lines , lines contain name.

var filename = path.combine(appdomain.currentdomain.basedirectory, "myfile.txt"); var results = file.readalllines(filename)     .tolist()     .select((row, indexer) => new { linenumber = indexer, line = row })     .where(item => !string.isnullorwhitespace(item.line) && !item.line.tolower().contains("name"));  foreach (var item in results) {     console.writeline(item.line); }

test file (does not include other columns focus on blank lines , repeating headers)

name karen jim harry mary  name mark    lam


please remember mark replies answers if , unmark them if provide no help, others looking solutions same or similar problem. contact via twitter (karen payne) or facebook (karen payne) via msdn profile not answer coding question on either.
vb forums - moderator
profile karen payne on stack exchange, network of free, community-driven q&a sites




Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'