Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ Running the server
➜ Shell question
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Ithildin
USA (262 posts) Bio
|
Date
| Thu 17 Mar 2005 12:10 AM (UTC) |
Message
| I'm wondering if there is a command in unix that lets you take information from one file and put it into another.
IE: I'm logging someone and want to put all their logged commands into another file so I don't have to wade through the other logged commands. Is there a command in shell that can do this?
sample:
send *logged commands* *name* *file1* to *file2* | Top |
|
Posted by
| Robert Powell
Australia (367 posts) Bio
|
Date
| Reply #1 on Thu 17 Mar 2005 02:40 AM (UTC) Amended on Thu 17 Mar 2005 02:42 AM (UTC) by Robert Powell
|
Message
| i think you should be able to grep the file and pipe the output into another file, as for correct syntax i dont remember, tho i remember doing this sort of thing in my old xenox classes at TAFE back in the mid 90's heh. |
Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated. | Top |
|
Posted by
| Ithildin
USA (262 posts) Bio
|
Date
| Reply #2 on Thu 17 Mar 2005 09:01 PM (UTC) Amended on Thu 17 Mar 2005 10:31 PM (UTC) by Ithildin
|
Message
| Yea, I have been looking at grep alot, but how do i pipe it into another file? Guess I can go try to look it up over internet.
_____________________________________-
I didn't find anything. I found that | is the pipe function.
I tried
[code]
grep 'name' *.log -ni | name.txt
[/code]
and it said name.txt not good. | Top |
|
Posted by
| Robert Powell
Australia (367 posts) Bio
|
Date
| Reply #3 on Thu 17 Mar 2005 11:54 PM (UTC) Amended on Fri 18 Mar 2005 12:14 AM (UTC) by Robert Powell
|
Message
| It has been a long time since i did NUX command line, i think you need to use a redirect not a pipe > then filename, but i could be wrong.
So grep string log.file > out.file will work, now what you could do if you want to be real tricky is pipe the output of the first grep into a second grep and then to a file, so you can narrow the search down to what your looking for.
grep str1 log.file | grep str2 > out.file.
Hope that helps, its been a while since i did any of this stuff.
|
Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated. | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
16,710 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top