Skip to content

Instantly share code, notes, and snippets.

@gin135
Created July 4, 2017 02:01
Show Gist options
  • Save gin135/4107873286c851de3294d803b6838be5 to your computer and use it in GitHub Desktop.
Save gin135/4107873286c851de3294d803b6838be5 to your computer and use it in GitHub Desktop.
第29回シェル芸勉強会 Q8
#!/bin/sh
cat shellgei | # 元AAの出力
sed '/^ *$/d' | # 余分な行の除去
awk -vFS= '{for(i=1;i<=NF;i++){str[i]=str[i]""$i}} END{for(i=1;i<=NF;i++){print str[i]}}' | # 行列転置
grep -v '^ *$' | # 余分な列(この処理時点では行)の除去
awk -vFS= '{for(i=1;i<=NF;i++){str[i]=str[i]""$i}} END{for(i=1;i<=NF;i++){print str[i]}}' # 行列転置
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment