Skip to content

Instantly share code, notes, and snippets.

@gin135
Created July 4, 2017 01:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gin135/52f10be7f93bab9a89f92b692b5fbe95 to your computer and use it in GitHub Desktop.
Save gin135/52f10be7f93bab9a89f92b692b5fbe95 to your computer and use it in GitHub Desktop.
第29回シェル芸勉強会 Q5
#!/bin/sh
cat triangle | # 元テキストの出力
awk '{for(i=NF;i>=1;i--){st[NF-i]=$i" "st[NF-i]}} END{for(n in st){print st[n]}}' | # 右回転時の各段の出力
awk '{for(i=1;i<NR;i++){printf " "}; print $0}' | # 幅合わせの処理
tac # 上下の反転
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment