title: shell腳本中獲取指定行指定列來進行操作
date: 2019-11-27 16:27:49
tags:
1 2 3
4 5 6
7 8 9
1 2 3
4 5 6
7 8 9
1、獲取第2-5行
sed -n '2,5p' testfile
2、獲取2-3列
awk '{print \(2 \)3}' testfile
可選cut(忘了吧,別記太多,腦袋不夠用啊)
cat test123 | awk '{print \(2,\)3}' | sed -n '4,5p' | xargs -n 1 echo
