Omega Owners Forum
Chat Area => General Discussion Area => Topic started by: tunnie on 25 April 2013, 18:18:18
-
I used to be fairly good with Unix Awk/Grep sort commands, but I'm doing some now for the first time in about 4 years and I can remember sod all! :-[ :-[ :-[ :'( :'(
(btw I'm using Cygwin)
I've got a standard Apache log file, that I'm working from, in which I can successfully awk and sort, eg:
$ awk '{print $7}' ManU\ GameBShort.log | sort -u
From the apache log that gives me lots of rows like this, but with all kinds of usernames and other images ect:
users/tunnie/channels/1301/streams/14157378
users/tunnie/channels/1301/streams
users/tunnie/streams/delete
I removed a lot of custom directories and the username from example above, can't really post that! But in essence I only want to grep unique rows with unique username (tunnie) and "/1301/streams"
So all I want as a result of my command is a list of:
users/user1/channels/1301/streams
users/user2/channels/1301/streams
users/user3/channels/1301/streams
users/user4/channels/1301/streams
And drop all the other junk, but I'm flagging on how I can do this. :(
Help!
-
Tunnie its been nearly 20 years since I left unix..
but here is a short way: list the directories and re-direct it to a text file..
copy the file to windows and using sql import and export manager load them in sql server
then select distinct field name from table where field like '%Tunnie%parameter' ;D :y
-
well that is one way, yeah pipe it into a text file. But my SQL is just about as good as my Unix.
Got less and less techy in my current position, its set to be even less soon :(
-
or something like this
find . -exec grep -H "something" {} \;
-
that would still leave me in same position, it would work for single username i think, but i want all users, but unique requests :-\
-
that would still leave me in same position, it would work for single username i think, but i want all users, but unique requests :-\
really cant remember :-\
I need to read several documents again to solve your problem :-\ too tired sorry :y
-
or pipe it to a text file and write a small vb or javascript whatever :-\
-
or wait until my unix buddies are in tomorrow morning, which is looking increasingly like best option ;D ;D
-
or wait until my unix buddies are in tomorrow morning, which is looking increasingly like best option ;D ;D
yep :) :y
-
Should be easy Tunnie, but like cem, my unix is 20+ years old. Like cem I'd pipe it into a text file and sort from there ;)
-
Should be easy Tunnie, but like cem, my unix is 20+ years old. Like cem I'd pipe it into a text file and sort from there ;)
:) :y
-
WTF is the question? ??? ??? ??? ???
-
WTF is the question? ??? ??? ??? ???
Never mind the question, read the replies...... :o :o I have absolutely no idea what they are talking about..........and I pressed the translate button..... ::) ::) :D
-
WTF is the question? ??? ??? ??? ???
Never mind the question, read the replies...... :o :o I have absolutely no idea what they are talking about..........and I pressed the translate button..... ::) ::) :D
Likewise ............ ::) ::) ;D ;D
-
Should be easy Tunnie, but like cem, my unix is 20+ years old. Like cem I'd pipe it into a text file and sort from there ;)
Should be easy, embarrassed asking unix guys in the morning really :-[
-
15 years since my daily use of UNIX(™) so I can recall a bit but I wouldn't be using AWK. How about
$ cat GameBShort.log |grep '/1301/streams$' |sort -u
That should return all the lines you want but not uniquely. To get just one of each you would need to be more fancy try
$ cat GameBShort.log |grep '/1301/streams$' \{1\} |sort -u
I think.
I didn't quite get your "rows with unique username (tunnie)", do you want all users as in your example (user1, user2 etc..) or just 'tunnie'? Just tunnie is easy
$ cat GameBShort.log |grep 'tunnie' | grep '/1301/streams$' |sort -u
-
15 years since my daily use of UNIX(™) so I can recall a bit but I wouldn't be using AWK. How about
$ cat GameBShort.log |grep '/1301/streams$' |sort -u
That should return all the lines you want but not uniquely. To get just one of each you would need to be more fancy try
$ cat GameBShort.log |grep '/1301/streams$' \{1\} |sort -u
I think.
I didn't quite get your "rows with unique username (tunnie)", do you want all users as in your example (user1, user2 etc..) or just 'tunnie'? Just tunnie is easy
$ cat GameBShort.log |grep 'tunnie' | grep '/1301/streams$' |sort -u
Is that legal?.................... :-X
-
'Unix Awk/Grep' Klingon ? :-\
-
I've removed all the difficult bits, here it is in plain english :)
cat GameBShort dot log pipe grep quote tunnie unquote pipe grep forward slash one three zero one forward slash streams dollar backslash open curly braces one backslash close curly braces pipe sort minus u
-
I've removed all the difficult bits, here it is in plain english :)
cat GameBShort dot log pipe grep quote tunnie unquote pipe grep forward slash one three zero one forward slash streams dollar backslash open curly braces one backslash close curly braces pipe sort minus u
Thank you, that explains it all.................not....... :D :D
-
Cheers dbdb :y
I'll give that a go this morning :y
-
Cheers dbdb :y
I'll give that a go this morning :y
So that'll be sky off for the afternoon then and the student getting a slap off Uncle Rupe. ;D ;D