Read and Parse file in F#

Sample code 

open System.IO
open System

let ParseFile =
let fileData = File.ReadAllLines(@”C:\temp\log.log”)

let LookForErrors =
|> Seq.filter(fun x -> if x.Contains(“error”) then false else true)

let LookForWarning =
|> Seq.filter(fun x -> if x.Contains(“warning”) then true else false)

let mynewfiledata =
let mynewfiledata = Seq.append LookForWarning LookForErrors
let FileSummary = “Number of Entries : ” + fileData.Length.ToString() + ” Number of Errors : ” + (LookForErrors |> Seq.length).ToString()
Seq.append ( FileSummary |> Seq.singleton) mynewfiledata

File.WriteAllLines(“c:\\temp\Test.txt”, mynewfiledata)


Copy only file path

1. Press Shift and right click on the any file/folder

2. You get additional menu items “Copy as path”.

This will only copy the path not the file.


Note: This is available in windows 7.

To make it run in windows XP install this small utility from here

How to install :

->Extract files

-> Right click on .inf file and install it .


Hope this help 🙂