精華區beta FreeBSD 關於我們 聯絡資訊
※ 引述《[email protected] (我愛QQ)》之銘言: > 各位大大 > 請問一下,如果我只要文字檔的部份內容 例如: 第十行以後的資料 > 那我要下什麼指令呢? tail +11 filename 取第 11 開始與往下所有內容。 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 現代人普遍的現象: 「小學而大遺」、「捨本而逐末」 「以偏而概全」、「因噎而廢食」 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ※ Origin: SayYA 資訊站 <bbs.sayya.org> ◆ From: kendlee.sayya.org > -------------------------------------------------------------------------- < 發信人: [email protected] (gugod), 看板: FreeBSD 標 題: Re: 只要文字檔的部份內容 發信站: 鳥窩 BBS (Sat Jun 7 05:44:36 2003) 轉信站: Ptt!news.ntu!freebsd.ntu!News.Math.NCTU!birdnest ※ 引述《[email protected] (我愛QQ)》之銘言: : 各位大大 : 請問一下,如果我只要文字檔的部份內容 例如: 第十行以後的資料 : 那我要下什麼指令呢? 請愛用 tail 跟 head 組合 參數請看一下 man page Example: 前10行: cat blah.txt | head 後 10 行: cat blah.txt | tail 第 3 行到第 29 行 cat blah.txt | head -29 | tail -26 第十行以後: wc blah.txt , 看一下總共幾行 cat blah.txt | tail -xx > -------------------------------------------------------------------------- < 發信人: [email protected] (gugod), 看板: FreeBSD 標 題: Re: 只要文字檔的部份內容 發信站: 鳥窩 BBS (Sat Jun 7 05:49:56 2003) 轉信站: Ptt!news.ntu!freebsd.ntu!News.Math.NCTU!birdnest ※ 引述《gugod (gugod)》之銘言: : 第十行以後: : wc blah.txt , 看一下總共幾行 : cat blah.txt | tail -xx 自己補充,你可以用 awk 來幫你算一下,第十行以後要從那裡開始 wc blah.txt|awk {'print $1 - 10'} 所以,一起寫下來就變成 cat blah.txt| tail -`wc blah.txt|awk {'print $1 - 10'}` 這就是直接拿到第十行以後的方法