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.app
Example:ssh
If file.txt
has the following content:阿里雲
name age alice 21 ryan 30
Output the following:debug
name alice ryan age 21 30
看例子,其實要作的事情很清楚吧,而後能夠用 awk(awk是行處理器: 相比較屏幕處理的優勢,在處理龐大文件時不會出現內存溢出或是處理緩慢的問題,一般用來格式化文本信息) ,來看看怎麼寫,下面這種寫法也是我第一次見。code
awk '{ for(i=1; i<=NF; ++i) {if (word[i] == "") {word[i] = $i} else{word[i] = word[i]" "$i}}} END{for(i=1; i<=NF; ++i) {print word[i]}}' file.txtblog
固然中間有個小插曲,由於我想在阿里雲的機器上試試,結果總是顯示內存
那我用 ssh -v 試試,打印出 debug 信息,毫無進展it
而後就是查看 /etc/hosts.allow 和 /etc/hosts.deny 看裏面有沒有配置信息,由於你們都說是啓用了 TCP Wrapper 訪問控制所致awk
可是裏面什麼信息都沒有,放棄了,不是這個問題
而後也說了不少鏈接數的問題,其實我都知道這個不會是,由於就我本身玩呀,能夠用lsof -i:22 看看
什麼都沒有改變,那到底什麼不同嗎,我以爲只能是網絡了,果真用了手機的熱點,就能夠訪問了,可是咱們公司的網絡又作了什麼事情呢?