aspose file tools*
The moose likes Linux / UNIX and the fly likes how do i finish this commmand Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "how do i finish this commmand" Watch "how do i finish this commmand" New topic
Author

how do i finish this commmand

johny doe
Ranch Hand

Joined: Dec 07, 2007
Posts: 78
Find all logged-in users with usernames of at least 4 characters ??

i know that in order to get all logged in users and only the names
i need
who|cut -d" " -f1|uniq

know how do i continue the command so it will find
usernames of at least 4 characters ??

i am not sure that my way is the right one

so feel free to give other versions
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

You can use grep and some regular expression for that. That's if you want to make it into one single command. If you're allowed to bash script, then that's should be fairly straightforward.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
johny doe
Ranch Hand

Joined: Dec 07, 2007
Posts: 78
i need to do it in one command
how do i use grep here??

how do i test the length of the user name?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

Pipe the result through "grep", and use a regular expression that says "four characters, optionally followed by more." I'm assuming this is a school assignment, so I'm not going to actually type the command for you, but hopefully this is enough.


[Jess in Action][AskingGoodQuestions]
minal silimkar
Ranch Hand

Joined: Nov 25, 2007
Posts: 133
try this command

who | cut -d "|" -f1 | uniq | awk 'length>3'
[ December 23, 2007: Message edited by: minal silimkar ]

Minal Silimkar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how do i finish this commmand