gpt4 book ai didi

linux - 使用 Last 和 tr 剪切行和列

转载 作者:太空宇宙 更新时间:2023-11-04 05:31:28 28 4
gpt4 key购买 nike

用户从“最后”命令中选择要剪切的行以及列切割。除了使用变量之外,还使用“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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com