Re: [gentoo-user] [OT] find lines in text file by length

2011-01-29 Thread Willie Wong
On Sat, Jan 29, 2011 at 03:08:11PM +, Etaoin Shrdlu wrote:
> Oh, and obviously
> 
> grep '.\{300\}' file
> 

D'Oh! That's really obvious. Thanks!

W

-- 
Willie W. Wong ww...@math.princeton.edu
Data aequatione quotcunque fluentes quantitae involvente fluxiones invenire 
 et vice versa   ~~~  I. Newton



Re: [gentoo-user] [OT] find lines in text file by length

2011-01-29 Thread Etaoin Shrdlu
On Sat, 29 Jan 2011 14:57:28 +
Etaoin Shrdlu  wrote:

> On Sat, 29 Jan 2011 10:01:02 -0500
> Willie Wong  wrote:
> 
> > This is way OT, but I hope someone here can give me a quick answer:
> > 
> > I have a text-file. Individual lines of it run from 10 to several
> > thousand characters in length. Is there a simple* command that allows
> > me to only display the lines that are, say, at least 300 characters
> > long?
> 
> awk 'length >= 300' file
> 
> sed -n '/.\{300\}/p' file

Oh, and obviously

grep '.\{300\}' file

perl -ne 'print if /.{300}/' file



Re: [gentoo-user] [OT] find lines in text file by length

2011-01-29 Thread Florian Philipp
Am 29.01.2011 16:01, schrieb Willie Wong:
> This is way OT, but I hope someone here can give me a quick answer:
> 
> I have a text-file. Individual lines of it run from 10 to several
> thousand characters in length. Is there a simple* command that allows
> me to only display the lines that are, say, at least 300 characters
> long?
> 
> Thanks in advance, 
> 
> W
> 
> 
> * simple of course includes appropriate incantations of sed/awk/perl/etc

egrep '.{300,}'



signature.asc
Description: OpenPGP digital signature


Re: [gentoo-user] [OT] find lines in text file by length

2011-01-29 Thread Petri Rosenström
On Sat, Jan 29, 2011 at 5:01 PM, Willie Wong  wrote:
> This is way OT, but I hope someone here can give me a quick answer:
>
> I have a text-file. Individual lines of it run from 10 to several
> thousand characters in length. Is there a simple* command that allows
> me to only display the lines that are, say, at least 300 characters
> long?
>
> Thanks in advance,
>
> W
>
>
> * simple of course includes appropriate incantations of sed/awk/perl/etc
> --
> Willie W. Wong                                     ww...@math.princeton.edu
> Data aequatione quotcunque fluentes quantitae involvente fluxiones invenire
>         et vice versa   ~~~  I. Newton
>
>
Hi,

Try something like

sed '/\w\{300,\}/!d' file

This should give you lines that have more than 300 word like
characters. If you put number after "," you may define the max number.
and you can change \w to match your needs => . .

Best regards
Petri



Re: [gentoo-user] [OT] find lines in text file by length

2011-01-29 Thread Etaoin Shrdlu
On Sat, 29 Jan 2011 10:01:02 -0500
Willie Wong  wrote:

> This is way OT, but I hope someone here can give me a quick answer:
> 
> I have a text-file. Individual lines of it run from 10 to several
> thousand characters in length. Is there a simple* command that allows
> me to only display the lines that are, say, at least 300 characters
> long?

awk 'length >= 300' file

sed -n '/.\{300\}/p' file



[gentoo-user] [OT] find lines in text file by length

2011-01-29 Thread Willie Wong
This is way OT, but I hope someone here can give me a quick answer:

I have a text-file. Individual lines of it run from 10 to several
thousand characters in length. Is there a simple* command that allows
me to only display the lines that are, say, at least 300 characters
long?

Thanks in advance, 

W


* simple of course includes appropriate incantations of sed/awk/perl/etc
-- 
Willie W. Wong ww...@math.princeton.edu
Data aequatione quotcunque fluentes quantitae involvente fluxiones invenire 
 et vice versa   ~~~  I. Newton