Leetcode no. 194
来源:互联网 发布:织梦404页面制作 编辑:程序博客网 时间:2024/05/25 18:11
194. Transpose File
Given a text file file.txt
, transpose its content.
You may assume that each row has the same number of columns and each field is separated by the ' '
character.
For example, if file.txt
has the following content:
name agealice 21ryan 30
Output the following:
name alice ryanage 21 30
# Read from the file file.txt and print its transposed content to stdout.awk '{ for(i=1; i<=NF; i++) {if(NR==1){ a[i]=$i; }else {a[i]=a[i] " " $i;}}}END { for(i=1; i<=NF;i++){print a[i];}}' file.txt
0 0
- Leetcode no. 194
- LeetCode No.11 ~No.12
- Leetcode NO.78 Subsets
- Leetcode NO.77 Combinations
- Leetcode NO.46 Permutations
- 【leetcode】No. 235 LCABST
- LeetCode no. 35
- Leetcode no. 37
- Leetcode no. 279
- Leetcode no. 335
- Leetcode no. 283
- Leetcode no. 181 (sql)
- Leetcode no. 40
- Leetcode no. 238
- Leetcode no. 26
- Leetcode no. 80
- Leetcode no. 228
- Leetcode no. 313
- 安卓系统重启次数统计
- kmp模板
- ffmpeg与x264编码指南 转码优化
- WebRoot和Web-Info区别
- 入门篇
- Leetcode no. 194
- netty日志LoggingHandler怎么用
- 魂牵梦萦地魂牵梦萦地要a
- uboot 编译解析
- Yarn通信协议与工作流程
- 消息循环中TranslateMessage和Dispatch函数的作用
- 函数回调机制、异步函数回调机制图例详解
- Oracle数据库,忽略大小写Like模糊查询(SQL Server,MySql原理相同)
- hdu 1850 尼姆博弈