[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

basic script question

Posted on 2011-04-20
7
Medium Priority
?
248 Views
Last Modified: 2012-05-11
How do I grep the UID for the specific username? I need a one line command. I am trying this and printing all them.


cat /etc/passwd | grep  -i  mark  | awk '{ FS=":"; print $3}'
0
Comment
Question by:mokkan
7 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 672 total points
ID: 35434046
cat /etc/passwd | awk -F: '{ print $3;}'
0
 
LVL 31

Assisted Solution

by:farzanj
farzanj earned 672 total points
ID: 35434048
Or you can do this for user mark:
cat /etc/passwd | grep  -i  mark  | awk -F: '{ print $3;}'
0
 
LVL 3

Assisted Solution

by:c0s
c0s earned 332 total points
ID: 35434052
cat /etc/passwd | grep root |  awk '{ FS=":"; print $3}'
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 3

Assisted Solution

by:stetor
stetor earned 332 total points
ID: 35434076
id -u mark
0
 
LVL 38

Assisted Solution

by:wesly_chen
wesly_chen earned 332 total points
ID: 35434699
awk -F: ' $1 ~ /mark/ {print $3}' /etc/passwd
0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 332 total points
ID: 35438804
grep "^mark:" /etc/passwd | cut -f3 -d:

Open in new window

0
 

Author Closing Comment

by:mokkan
ID: 35728028
thank you
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month17 days, 18 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question