• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how do i finish this commmand

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
johny doe
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i need to do it in one command
how do i use grep here??

how do i test the length of the user name?
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try this command

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