Еще один awk:
$ awk '!($1 in a)||a[$1]>$2{a[$1]=$2}END{for(i in a)print i,a[i]}' file
Вывод:
May -0.45623
Peter 0.08234
Joe 0.88765
Wilson -0.88341
Объяснено:
$ awk '
!($1 in a) || a[$1]>$2 { # if the key (name) has not yet been seen or its value is smaller
a[$1]=$2 # store it to hash a
}
END { # after processing all the records
for(i in a) # go thru the stored keys
print i,a[i] # print them and their value
}' file
Следующее является примером, я смог, соединяет, от какого я нашел на этом блоге
open Microsoft.FSharp.Linq.QuotationEvaluation
open Microsoft.FSharp.Linq
let IsPermited (serviceName:string) =
//Instantiate the Entity
let data = new BusModelContainer()
//Build your query
let services = Query.query <@ seq{ for service in data.ServiceSet do
service.Name.Equals(serviceName) && service.IsEnabled then
yield service } @>
if Seq.is_empty services then
false
else
true
Вот код из блога, который показал мне, как пойти о выборе из Объекта
let db = new FSharpSampleDB(connString)
Query.query <@ seq { for c in db.Customers do
if id = c.CustomerId then
yield (new Customer(c.CustomerId, c.Name, c.Balance))}
|> Seq.hd @> :> ICustomer