gpt4 book ai didi

bash - 如何从输出中删除前两行

转载 作者:行者123 更新时间:2023-11-29 08:45:55 26 4
gpt4 key购买 nike

我在文本文件中有以下输出:

106 pages in list
.bookmarks
20130516 - Daily Meeting Minutes
20130517 - Daily Meeting Minutes
20130520 - Daily Meeting Minutes
20130521 - Daily Meeting Minutes

我想从我的输出中删除前两行。我用来执行的这个特定的 shell 脚本总是包含前两行。

这是我生成和读取文件的方式:

#Lists
PGLIST="$STAGE/pglist.lst";
RUNSCRIPT="$STAGE/runPagesToMove.sh";

#Get List of pages
$ATL_BASE/confluence.sh $CMD_PGLIST $CMD_SPACE "$1" > "$PGLIST";

# BUILD executeable script
echo "#!/bin/bash" >> $RUNSCRIPT 2>&1
IFS=''
while read line
do
echo "$ATL_BASE/conflunce.sh $CMD_MVPAGE $CMD_SPACE "$1" --title \"$line\" --newSpace \"$2\" --parent \"$3\"" >> $RUNSCRIPT 2>&1
done < $PGLIST

如何删除前两行?

最佳答案

您可以使用 tail 实现此目的:

tail -n +3 "$PGLIST"
  -n, --lines=K
output the last K lines, instead of the last 10; or use -n +K
to output starting with the Kth

关于bash - 如何从输出中删除前两行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24542425/

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