Sed 常用筆記 - 將文本內容順序顛倒


Posted by on August 3, 2018

經典範例,將文件行序顛倒:
# reverse order of lines (emulates “tac”)
# bug/feature in HHsed v1.5 causes blank lines to be deleted
sed ‘1!G;h;$!d’ # method 1
sed -n ‘1!G;h;$p’ # method 2
sed -n ‘1h;1n;G;h;$p’ # method 3

本站總訪問量訪客