![]() |
UNIX Command Question- How do I just extract line 'X' - Printable Version +- MacResource (https://forums.macresource.com) +-- Forum: My Category (https://forums.macresource.com/forumdisplay.php?fid=1) +--- Forum: Tips and Deals (https://forums.macresource.com/forumdisplay.php?fid=3) +--- Thread: UNIX Command Question- How do I just extract line 'X' (/showthread.php?tid=5002) |
UNIX Command Question- How do I just extract line 'X' - microchip13 - 02-19-2006 Like just extract line 1? I would think it'd be something like grep -l 1 or something.. Re: UNIX Command Question- How do I just extract line 'X' - hwystar - 02-19-2006 If you want to do something like that, take a look at the man info for the 'more' or 'less' commands. That might be the appropriate tool for a simple job like that. HTH hwystar Re: UNIX Command Question- How do I just extract line 'X' - microchip13 - 02-19-2006 Sweet, thanks yet again hwystar. Re: UNIX Command Question- How do I just extract line 'X' - blooz - 02-19-2006 You got over the smashed finger fast enough. Or are you typing with your toes? Re: UNIX Command Question- How do I just extract line 'X' - TheTominator - 02-19-2006 How about combining both 'head' and 'tail'? To extract the 100th line head -n 100 thefilename.txt | tail -n 1 Re: UNIX Command Question- How do I just extract line 'X' - pdale - 02-19-2006 HEAD(1) BSD General Commands Manual HEAD(1) NAME head -- display first lines of a file SYNOPSIS head [-n count] [file ...] DESCRIPTION This filter displays the first count lines of each of the specified files, or of the standard input if no files are specified. If count is omitted it defaults to 10. If more than a single file is specified, each file is preceded by a header consisting of the string ``==> XXX <=='' where ``XXX'' is the name of the file. |