You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This discussion was converted from issue #17 on August 14, 2022 06:20.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
问题
一个CSV文件TAB分割,假设名为data.txt,第二列是userid。
另外有一个文件是userid的文件,假设名为userid.txt。每一行都是一个userid。
过滤data.txt,找到userid.txt中的userid的数据来输出。
一行awk解法
解读
BEGIN是在awk循环解析之前都初始化阶段。
a[$1]=1
建立关联数组,userid.txt里的每个userid为key,value为1。Beta Was this translation helpful? Give feedback.
All reactions