homepage Welcome to WebmasterWorld Guest from 54.211.157.103
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
linux command help
indiandomain




msg:907879
 12:52 pm on Dec 4, 2004 (gmt 0)

have a txt file of dictionary words on my server.

need to extract only those with 5 letters or less...is it possible using some linux command?

i tried grep but it doesnt work.

thanks
sam

 

mm1220




msg:907880
 1:20 pm on Dec 4, 2004 (gmt 0)

Is each word on a new line?

indiandomain




msg:907881
 1:56 pm on Dec 4, 2004 (gmt 0)

yes
like

amazon
people
love
#*$!
purple

.
.
.

nalin




msg:907882
 8:05 pm on Dec 4, 2004 (gmt 0)

try sed:
sed 's/^.\{6,\}$//' < filename.txt
This kill all lines containing 6 or more charicters (prints to stdout, does not modify the original file)

mcavic




msg:907883
 9:49 pm on Dec 4, 2004 (gmt 0)

grep -v '......' file.txt

will remove any lines that have at least 6 characters.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved