::: Zany's Homepage ::: Zany Wiki | »çÀÌÆ® ÅëÇÕ °Ë»ö
 
 
 

How to crop(cut) text files based on starting and ending line-numbers in cygwin?

°Ô½ÃÆÇ
Unix/Linux
ÀÛ¼ºÀÚ
helix
ÀÛ¼ºÀÏ
2015-12-29 12:48:07
ÀÐÀº¼ö
2212
ÆòÁ¡
   
Ç¥½Ã¿É¼Ç
HTML»ç¿ë | ÀÚµ¿BRűנ| °ø¹é¹®ÀÚÇã¿ë | °¡¿îµ¥Á¤·Ä | °íÁ¤Æø±Û²Ã | ÀÚµ¿URL¸µÅ© | ¸¶¿ì½º¼±ÅÃ
°ü·Ã¸µÅ©01
http://stackoverflow.com/questions/5683367/how-to-cropcut-text-files-based-on-starting-and-ending-line-numbers-in-cygwin 

Sounds like a job for sed:

sed -n '8,12p' yourfile

...will send lines 8 through 12 of yourfile to standard out.



If you want to prepend the line number, you may wish to use cat -n first:

cat -n yourfile | sed -n '8,12p'

 °Ô½ÃÆÇ ±Û ¸ñ·Ï
No Subject Poster Hits Posted
13498 helix 5521 2016-07-08 00:48:24
13493 helix 1622 2016-07-06 02:46:55
13488 helix 1779 2016-07-05 19:39:23
13487 helix 3250 2016-07-05 18:44:22
13081 helix 2395 2015-12-30 00:55:40
helix 2212 2015-12-29 12:48:07
12851 helix 1900 2015-11-27 15:34:03
11855 helix 2125 2015-07-20 00:35:28
11004 helix 2556 2015-03-24 02:50:29
10878 helix 3289 2015-03-06 12:32:41
10760 helix 5444 2015-02-16 23:36:31
ÄÚ¸àÆ®
ÀÛ¼ºÀÚ
                       
 
zany.kr
  Copyright ¨Ï 2002-2010 Zany's Programming Lab. All Rights Not Reserved.
temporary This Page loads on 0.016 Secs