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 =
fileData
|> Seq.filter(fun x -> if x.Contains(“error”) then false else true)

let LookForWarning =
fileData
|> 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.

image

Note: This is available in windows 7.

To make it run in windows XP install this small utility from here
https://skydrive.live.com/embed?cid=1F188D9EA75A6E2B&resid=1F188D9EA75A6E2B%21509&authkey=AIp8RrlDBaP2l4o

How to install :

->Extract files

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

 

Hope this help 🙂