Welcome to WebmasterWorld Guest from 54.144.206.214

Forum Moderators: bakedjake

linux command help

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

10+ Year Member



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)

10+ Year Member



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

10+ Year Member



yes
like

amazon
people
love
#*$!
purple

.
.
.

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

10+ Year Member



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)

WebmasterWorld Senior Member 10+ Year Member



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

will remove any lines that have at least 6 characters.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month