Livejournal
Log in
Post
Friends
My journal
xiombarg
UNIX
Mar 29, 2007 12:36
Ah, you know I'm a geek when I get a small measure of joy out of putting together strings of UNIX commands like...
cut -d " " -f1 php-access_log.1 | strings | sort | uniq -c > /tmp/ips.txt
random
,
work
Leave a comment
Comments 4
tfofurn
March 29 2007, 17:10:30 UTC
Did I post about wanting to delete all but the 20 most recent log files a while ago? It's easy on the command line, just something like:
ls -t log* | tail +21 | xargs rm
It's a nightmare in C.
Reply
adamdray
March 30 2007, 17:35:05 UTC
Yeah, I need to do something like "move the backup from the first day of each month to the MONTHLY directory and keep the most recent 14 daily backups." I didn't know about xargs. I'd probably handle that with a find... -exec... command.
Reply
kyril
March 30 2007, 02:21:42 UTC
I always liked the ftp command get whatever.tar.gz "|gzip -dc | tar xf -"
Reply
adamdray
March 30 2007, 17:32:57 UTC
We used to do similarly weird things with
ttcp
, examples of which the late Mike Muuss has happily provided:
For example, on the destination machine, use:
ttcp -r | tar xvpf -
and on the source machine:
tar cf - directory | ttcp -t dest_machine
As for Kirt's "cut" string, I would-a used awk. ;)
Reply
Leave a comment
Up
Comments 4
ls -t log* | tail +21 | xargs rm
It's a nightmare in C.
Reply
Reply
Reply
For example, on the destination machine, use:
ttcp -r | tar xvpf -
and on the source machine:
tar cf - directory | ttcp -t dest_machine
As for Kirt's "cut" string, I would-a used awk. ;)
Reply
Leave a comment