cat [file] | grep --- trouble
hey all,
quick little problem here, i have a log from my IRC channel, i want to use CAT on it for specific users for example cat [logfile] | grep "username" but the problem im getting is that the usernames are wrapped in < >'s what would i need to do to get cat or grep to ignore the < >'s and just treat them as part of a word? ive tried wrapping `word` "word" and 'word' and I still get nothing. any help is appreciated. Matty G |
Quote:
|
Quote:
Code:
grep username logfile |
seem to have it now, i havent changed the code or anything, hmm,
thanks anyway Matty G |
Quote:
i only want to bring back lines by specific users E.G. grep for bobman brings back sum 400 lines grep for <bobman> brings back some 200 lines +/- 2 or 3 lines where someone will have quoted my own words, got it sorted now anyway, i think i may have been telling cat to look at the wrong log file, thanks again Matty G |
Hi,
pls try out this command and see if it answers your query # cat [logfile] | grep --color "[<]" Pls see if it works or not.... |
ok, sorry for the 3rd post but I have another question
I want to tail this log file and find the last 100 lines a user wrote (using <>'s again im afraid) if i use tail -100 "logfile" | grep "<bobman>" it only brings back <bobman> from the last 100 lines, which thinking about it, is what it should do, what other ways should i go about pulling the last 100 lines of <bobman> from the log file? |
Quote:
yes it works all too well, it pulls every line form the log file, viva la ctrl+c :p |
Quote:
Code:
grep "<bobman>" logfile | tail -100 |
You can grep then use tail to get the last 100 entries for a person.
grep "<bob>" logfile | tail -n 100 |
ahh, switch them round...
i see, thats how it is, is it? excelent, thanks guys. EDIT - i get this grep: writing output: Invalid argument |
You got this error while running which command ?
|
I run this
grep "<bob_man>" "#devhardware.GoodChatting.com.log" | tail -n 50 ok, ok i quess i will need to come clean here, Im using ports of unix tools to do this on my home pc which.... is windows XP, forget it, i guess i could knife and fork it by cat logfile | grep username > username.txt then tail the last 20 lines or something. thanks all the same. Matty G |
All times are GMT -5. The time now is 04:56 PM. |