We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
今天一个同事在分析kafka的分区信息,他通过describe topic将所有的分区信息打到了一个csv文件,文件格式如下
//topic //partition ids xm_passport.tb_thirdparty_user_adpter 11317,11417,11617
现在他想做的一件事情是做一个类似scala里的flatMap,
他期望的格式如下
xm_passport.tb_thirdparty_user_adpter 11317 xm_passport.tb_thirdparty_user_adpter 11417 xm_passport.tb_thirdparty_user_adpter 11617
于是找我帮忙,23333,估计看我长着一张运维脸:(
其实也很简单,awk简单弄下就行了
▶ cat test xm_passport.tb_thirdparty_user_adpter 11317,11417,11617 xm_passport.tb_test 11317,11318,11417 ~ ▶ cat test| awk '{split($2,array,",");for (i in array){$2 = array[i];print $0}}' xm_passport.tb_thirdparty_user_adpter 11417 xm_passport.tb_thirdparty_user_adpter 11617 xm_passport.tb_thirdparty_user_adpter 11317 xm_passport.tb_test 11318 xm_passport.tb_test 11417 xm_passport.tb_test 11317 ~ ▶
The text was updated successfully, but these errors were encountered:
No branches or pull requests
awk行转列
今天一个同事在分析kafka的分区信息,他通过describe topic将所有的分区信息打到了一个csv文件,文件格式如下
现在他想做的一件事情是做一个类似scala里的flatMap,
他期望的格式如下
于是找我帮忙,23333,估计看我长着一张运维脸:(
其实也很简单,awk简单弄下就行了
The text was updated successfully, but these errors were encountered: