how to grep sort userids


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to grep sort userids
# 1  
Old 04-02-2009
how to grep sort userids

hello folks

i have a file that have data like

/test/aa/123
/test/aa/xyz

/test/bb/xyz
/test/bb/123

in above lines i just wants to grep "aa" and "bb".

Thanks,
Bash
# 2  
Old 04-02-2009
Hello there,

It may seem a trivial question, but did you try to see whether the grep command itself does the job? (or maybe I didn't understand the exact output form that you're looking for)

Smilie
# 3  
Old 04-02-2009
Quote:
Originally Posted by learnbash
hello folks

i have a file that have data like

/test/aa/123
/test/aa/xyz

/test/bb/xyz
/test/bb/123

in above lines i just wants to grep "aa" and "bb".

Thanks,
Bash
Try this:
Code:
awk-f\/ '{print $2}'

# 4  
Old 04-02-2009
Quote:
Originally Posted by siquadri
Try this:
Code:
awk-f\/ '{print $2}'

Thanks appreciated.
# 5  
Old 04-02-2009
Quote:
Originally Posted by siquadri
Try this:
Code:
awk-f\/ '{print $2}'

Should be:

Code:
awk -F/ '{print $2}'

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

awk with Grep and Sort

1. The problem statement, all variables and given/known data: Please bare in mind I am a complete novice to this and have very very basic knowledge so please keep any answers as simple as possible and explain in terms I will understand ahha :):) I have a text file of names and test scores... (1 Reply)
Discussion started by: jamesb18
1 Replies

2. Homework & Coursework Questions

awk questions using sort and grep

1. The problem statement, all variables and given/known data: So i'll probably get told off for this but I have a few problems and rather than clog up the whole forum I'll post them here. Please bare in mind I am a complete novice when it comes to all this and so if you help please treat me like a... (4 Replies)
Discussion started by: jamesb18
4 Replies

3. Homework & Coursework Questions

Grep and Sort

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 1. Print the number of people that are in the /etc/passwd file with the name of George 2. Sort by name and... (8 Replies)
Discussion started by: Jagst3r21
8 Replies

4. Shell Programming and Scripting

grep from 3 lines and sort

Pseudo name=hdiskpower54 Symmetrix ID=000190101757 Logical device ID=0601 state=alive; policy=SymmOpt; priority=0; queued-IOs=0 ============================================================================== ---------------- Host --------------- - Stor - -- I/O Path - -- Stats --- ### HW... (7 Replies)
Discussion started by: Daniel Gate
7 Replies

5. Shell Programming and Scripting

Grep empty space and sort

Hi Expert, Kindly request for your expertise in this matter. I have below output: 12.125.124.173,xx1.common.com 12.125.124.174,xx2.common.com 12.125.124.175,xx3.common.com 12.125.124.176, 12.125.124.177, 12.125.124.178, 12.125.124.179,xx4.common.com 12.125.124.180,xx5.common.com... (8 Replies)
Discussion started by: regmaster
8 Replies

6. Shell Programming and Scripting

history awk grep sort

can someone help me in the awk part...little confuse on that part. The problem is this: what input each utility gets and what it does with data and what output is provides to the next utility) history | awk '{a++}END{for(i in a){print a " " i}}' | sort -rn | grep '^' Thanks (4 Replies)
Discussion started by: Learnerabc
4 Replies

7. Shell Programming and Scripting

Script to capture userids logged on & killing as well

Can someone help me with a script to capture the list of users logged on at a point of time, and if a particular user id say xyz exists, kill that process Id. (2 Replies)
Discussion started by: ggayathri
2 Replies

8. Shell Programming and Scripting

Grep userids

Hey, what's the best way to use grep to list all userid's on the system that do not contain the "." character (period). Also, could I edit the same command to list all the userid's on the system that are 10 or more characters in length. Thanks, I'm not that familiar with grep, but I know it can do... (1 Reply)
Discussion started by: raidkridley
1 Replies

9. UNIX for Dummies Questions & Answers

Sort/Grep Question

Hello all, I have a test file that has the format: ..... O 3.694950 -.895050 1.480000 O 5.485050 .895050 1.480000 Ti -4.590000 4.590000 2.960000 Ti -2.295000 ... (5 Replies)
Discussion started by: aarondesk
5 Replies

10. UNIX for Dummies Questions & Answers

Will userids make a difference in performance?

I have nearly 10 users who login into the HP server (D series, HP UX 10.20) with the same UNIX user name, "liveuser", and they start the UNIX based transactions. If I create separate UNIX user-ids for all the 10, will the system performance improve? (1 Reply)
Discussion started by: augustinep
1 Replies
Login or Register to Ask a Question