Welcome to WebmasterWorld Guest from 54.146.1.178

Forum Moderators: bakedjake

Message Too Old, No Replies

linux command help

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

Junior Member

10+ Year Member

joined:Jan 14, 2003
posts:195
votes: 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

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

Full Member

10+ Year Member

joined:Sept 13, 2003
posts:214
votes: 0


Is each word on a new line?
1:56 pm on Dec 4, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 14, 2003
posts:195
votes: 0


yes
like

amazon
people
love
#*$!
purple

.
.
.

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

Junior Member

10+ Year Member

joined:Feb 17, 2004
posts:174
votes: 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)
9:49 pm on Dec 4, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 31, 2003
posts:1316
votes: 0


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

will remove any lines that have at least 6 characters.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members