history awk grep sort


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting history awk grep sort
# 1  
Old 02-18-2010
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)

Code:
history | awk '{a[$3]++}END{for(i in a){print a[i] " " i}}' | sort -rn | grep '^[0-9][0-9]'

Thanks

Last edited by Learnerabc; 02-18-2010 at 01:57 AM.. Reason: Please use code tags
# 2  
Old 02-18-2010
What you are trying to achieve ? and what is wrong ?
# 3  
Old 02-18-2010
what input each utility gets and what it does with data and what output is provides to the next utility)
# 4  
Old 02-18-2010
Can you show the result of the history command too?
# 5  
Old 02-18-2010
anyone????
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'ing dot history file

Hi, I tried to grep ".sh_history" (DOTsh_history) file and did not return anything though I found the word in .sh _history file through vi editor in Linux. Then I tried to grep ".profile" to check if it is the prob with hidden files and I got results. Then I verified the same with my friend... (4 Replies)
Discussion started by: bobbygsk
4 Replies

6. UNIX for Dummies Questions & Answers

grep with history command

Hi, history 800 | grep mail 387 mailx -s "test from `hostname`" mohtashims@gmail.com < /dev/null 388 mailx -s -a /tmp/hello.zip "test from `hostname`" mohtashims@gmail.com < /dev/null 389 mailx -s "test from `hostname`" mohtashims@gmail.com < /dev/null 390 mailx -s ... (5 Replies)
Discussion started by: shifahim
5 Replies

7. Shell Programming and Scripting

Using a combination of sort/cut/grep/awk/join/paste/sed

I have a file and need to only select users that have a shell of “/bin/bash” in the line using awk or sed please help (4 Replies)
Discussion started by: boyboy1212
4 Replies

8. Shell Programming and Scripting

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 (4 Replies)
Discussion started by: learnbash
4 Replies

9. UNIX for Dummies Questions & Answers

Problem with history and grep

okay, i did the command: echo `history` >> /new.txt i got a long line, which due to the size of my screen, it made 3 lines. i then tried the command: grep emacs new.txt while in root and i got a full the same long line any help appreciated (2 Replies)
Discussion started by: cleansing_flame
2 Replies

10. 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
Login or Register to Ask a Question