用户从“最后”命令中选择要剪切的行以及列 切割。除了使用变量之外,还使用“tr” 修复空白处的所有差异。我尝试了以下代码,但不知道哪里出错了。
echo -n "What rows and columns would you like to cut: "
read before
read after
read stop
read start
last | head -n $before friend_list | tail -n $after | tr -d $start $stop
最佳答案
这听起来就像你想要的是这样的:
last | head -n $after | tail -n $((after-before+1)) | cut -f $start-$stop
它将输出 last
的输出子集,从 $before
行到 $after
行,从 $start
列到 $stop
列。
关于linux - 使用 Last 和 tr 剪切行和列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15212967/