1 |
On Sat, Jan 29, 2011 at 5:01 PM, Willie Wong <wwong@××××××××××××××.edu> wrote: |
2 |
> This is way OT, but I hope someone here can give me a quick answer: |
3 |
> |
4 |
> I have a text-file. Individual lines of it run from 10 to several |
5 |
> thousand characters in length. Is there a simple* command that allows |
6 |
> me to only display the lines that are, say, at least 300 characters |
7 |
> long? |
8 |
> |
9 |
> Thanks in advance, |
10 |
> |
11 |
> W |
12 |
> |
13 |
> |
14 |
> * simple of course includes appropriate incantations of sed/awk/perl/etc |
15 |
> -- |
16 |
> Willie W. Wong wwong@××××××××××××××.edu |
17 |
> Data aequatione quotcunque fluentes quantitae involvente fluxiones invenire |
18 |
> et vice versa ~~~ I. Newton |
19 |
> |
20 |
> |
21 |
Hi, |
22 |
|
23 |
Try something like |
24 |
|
25 |
sed '/\w\{300,\}/!d' file |
26 |
|
27 |
This should give you lines that have more than 300 word like |
28 |
characters. If you put number after "," you may define the max number. |
29 |
and you can change \w to match your needs => . . |
30 |
|
31 |
Best regards |
32 |
Petri |