由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Quant版 - 求助一道题目啊!!!
相关主题
我总结了两个基本题目大家帮我看看对不对请教一道题
求助Logic testing for employment如何准备?[合集] WorldQuant phone interview
How to write this query in Oracle?[合集] 继续作贡献,一道积分题。
请教一道面试题啊!关于SQL的! EXCEL VBA in real world
SQL combine two columns from two different tables no shared (转载)A hedge fund interview questions (CS)
matlab 问题请教:读出空白行 (转载)Who has txt file contents major ticker symbols?
error of opening a file located in a remote server from pyt (转载)C++: how to dynamically allocate a 2-D array
Two Trend TestsExcel VBA help!!!
相关话题的讨论汇总
话题: step话题: ted话题: 01话题: 2000话题: jon
进入Quant版参与讨论
1 (共1页)
y******8
发帖数: 40
1
File “abcd” is a space-delimited file, and contains the following columns
of information:
Column 1: Name. Column 2: 1 - took test, 0 - didn’t. Column 3: Score.
Column 4: Date.
Contents of file “abcd”:
TED 1 75.5 01/01/2000
TED 1 80.1 01/02/2000
TED 0 00.0 01/03/2000
TED 1 45.5 01/04/2000
TED 1 94.7 01/05/2000
JON 1 88.1 01/01/2000
JON 1 65.1 01/02/2000
JON 0 00.0 01/03/2000
Contents of file “xyz”:
MOST PASSED TESTS
We want to find out who took the most tests with a grade of 50 or more.
Walk me through the following set of unix commands and tell me what the
result of the output should be at each step.
cat abcd | awk '$2==1 && $3>50 {print $1}' | \
sort | uniq -c | \
sort -n -r | \
head -1| \
awk '{print $2}' >> xyz
请问:下面的输出结果是什么啊?
Step 1:
cat abcd | awk '$2==1 && $3>50 {print $1}'
Output of Step 1:
Step 2: sort | uniq -c
Output of Step 2:
Step 3: sort –n –r
Output of Step 3:
Step 4: head -1
Output of Step 4:
Step 5: awk '{print $2}' >> xyz
Contents of xyz:
Solve the following problems using some combination of the commands:
cat, awk, sort, uniq, head.
Your approach should follow patterns similar to the previous problem.
1. Use file abcd to report each student with the maximum number of tests that they have taken. Results should be:
4 TED
2 JON
ANSWER:
2. Do the same as #1, but format the results to:
TED 4
JON 2
ANSWER:
3. Report the lowest test score of the tests that were taken, and the person who made it. Results should be:
TED 45.5
ANSWER:
4. Report the dates that any tests were taken. Results should be:
01/01/2000
01/02/2000
01/04/2000
01/05/2000
ANSWER:
1 (共1页)
进入Quant版参与讨论
相关主题
Excel VBA help!!!SQL combine two columns from two different tables no shared (转载)
[合集] Interview question for Quant to share-1, please discuss andmatlab 问题请教:读出空白行 (转载)
vb/excel 问题, 急!error of opening a file located in a remote server from pyt (转载)
另一道陈题Two Trend Tests
我总结了两个基本题目大家帮我看看对不对请教一道题
求助Logic testing for employment如何准备?[合集] WorldQuant phone interview
How to write this query in Oracle?[合集] 继续作贡献,一道积分题。
请教一道面试题啊!关于SQL的! EXCEL VBA in real world
相关话题的讨论汇总
话题: step话题: ted话题: 01话题: 2000话题: jon