From a text file, I want to extract only the words that contain more
than 16 characters.
How do you do this using vi editor or from the shell prompt?
How do you do this using vi editor or from the shell prompt?
> How do you do this using vi editor or from the shell prompt?
awk '{for(i=1;i<=NF;i++) if(length($i) > 16) print $i}' file
Joe
> How do you do this using vi editor or from the shell prompt?
tr -c '[:alpha:]' '[\n*]' < file | awk 'length>16'
You may have to adjust the 'tr' command to match your notion of word.
--
Tapani Tarvainen
>How do you do this using vi editor or from the shell prompt?
:1,$s/[ \t]/^M/g (17 repeats of [a-zA-Z]) Regards,
:v/[a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z]
( ^M use ctrl-v ctrl-m )
C Campbell
--
Charles E Campbell, Jr, PhD _ __ __
Goddard Space Flight Center / /_/\_\_/ /
PGP public key: http://www.erols.com/astronaut/pgp.html
How about ":v/[a-zA-Z]\{17\}/d".Quote:> :v/[a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z]/d
> (17 repeats of [a-zA-Z])
Btw, are there any vi's that don't understand this syntax (or "\{17,17\}")?
Peppe [just curious]
--
"Before you criticize someone, walk
Preben "Peppe" Guldberg __/-\__ a mile in his shoes. That way, if
----------------------oOOo (_) oOOo-- - and barefoot." --Sarah Jackson
many. e.g.,Quote:>How about ":v/[a-zA-Z]\{17\}/d".
>Btw, are there any vi's that don't understand this syntax (or "\{17,17\}")?
nvi: Version 1.79 (10/23/96) The CSRG, University of California, Berkeley.
says: The v command doesn't permit an address of 0.
--
okay, have a sig then
> From a text file, I want to extract only the words that contain more
> than 16 characters.
> How do you do this using vi editor or from the shell prompt?
John
--
use Perl;
program
fulfillment
1. enlightenment 0.16.4->0.16.5 patch?
hi folks
i've just seen that enlightenment has had a minor patch release...
question i have is, does anyone know where (if it exists) a patch
file for this release and the last
i can only find the entire tar balls and just dont have the bandwidth to
grab 11megs of src.
thanks in advance
ray
Sent via Deja.com http://www.deja.com/
Before you buy.
2. mount from one AIX server to another fails
3. ### 8M --> 16 megs ---> computer not faster?
4. Top 10 posters comp.unix.shell
5. Another SB-16 problem << MOUNT POINT \cdrom DOES NOT EXIST >>
6. Need help sorting coordinates.
7. CL-GD 5428 >8bpp >16 M patch
8. Max filesystem size OSR5.05 ?
9. Does having 16 MB of RAM make a BIG difference.
10. Does having 16 MB of RAM make a BIG differe