ITASC $ rm '-z'
rm: illegal option -- z
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
Simple: use the /- to depict dashes:
./CustomFunctions/.classpath ./-z tibco@pghdbeengl01:~/build $ rm ./-*
Rants and ravings of a semi-autistic developer who has a hard time remembering idiotic nonsense details. Why remember it, when you know where to find it.
ITASC $ rm '-z'
rm: illegal option -- z
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
Simple: use the /- to depict dashes:
./CustomFunctions/.classpath ./-z tibco@pghdbeengl01:~/build $ rm ./-*
10.75.80.77 2 - - [17/Apr/2012:08:52:32 -0400] "GET /EASE/admin/login.jsf HTTP/1.1" 302 - "-" "Mozilla/5.0"So here the regex to parse this...
my $expression =
qr/([0-9\.]+)\s+\d*\s?\-\s\-\s\[(\d+)\/(\w{3})\/(\d{4}):(\d+):.*\s[-+]\d+\]\s\"(POST|GET)\s(.+)\sHTTP\/(\d.\d)\"\s(\d{3})\s(\d+|-)\s\"(\S+)\"\s\"(.+)\"/x;
my (
$all, $ip, $dayofmonth, $month, $year,
$hourofday, $reqtype, $req, $protocol, $response,
$size, $ref, $agent
) = @rec = $_ =~ /($expression)/i;
Here an example of yet another parser implementation of apache logs... that greps all the POST and GET's
use Data::Dumper;
use Text::Table;
sub line {
my $x = shift;
$x = $x ? $x : $W;
for ( 1 .. $x ) { print "-"; }
print "\n";
}
BEGIN {
our $W = 70;
%row = ();
print "\n\n";
line($W);
printf "[%-35s]\n", $ARGV[$cc];
line($W);
$cc++;
}
my @rec =();
my $expression =
qr/([0-9\.]+)\s+\d*\s?\-\s\-\s\[(\d+)\/(\w{3})\/(\d{4}):(\d+):.*\s[-+]\d+\]\s\"(POST|GET)\s(.+)\sHTTP\/(\d.\d)\"\s(\d{3})\s(\d+|-)\s\"(\S+)\"\s\"(.+)\"/x;
my (
$all, $ip, $dayofmonth, $month, $year,
$hourofday, $reqtype, $req, $protocol, $response,
$size, $ref, $agent
) = @rec = $_ =~ /($expression)/i;
#print $dayofmonth, "\n";
if ($!) {
my ($approot) = $req =~ m!^\/(\w+)\/.*$!x;
my ($refhost) = $ref =~ m!https?\:\/\/([a-z.]+)\/.+!x;
my $v = sprintf "%s %s, %s", $month, $dayofmonth, $year;
$row{$response}{'byreq'}{$v}{$req}++;
my $hkey = sprintf "%s-%s", $approot, $refhost;
my $dkey = sprintf "%s-%s", $hourofday,$hkey;
#print Dumper(\@rec);
#die "deeeee", $v;
$row{$response}{'byreqref'}{$v}{$req}{$ref}++;
$row{$response}{'byhodreq'}{$v}{$hourofday}++;
$row{$response}{'byipsub'}{$v}{$ip}++;
$row{$response}{'bycontext'}{$v}{$approot}++;
$row{$response}{'byrefhost'}{$v}{$hkey}++;
$row{$response}{'byrefhosthod'}{$v}{$dkey}++;
}
else {
print "skiping $_\n";
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
<log4j:configuration>
<!--
an appender is an output destination, such as the console or a file;
names of appenders are arbitrarily chosen
-->
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %c (%F:%L) %m%n"/>
</layout>
</appender>
<appender name="stderr" class="org.apache.log4j.ConsoleAppender">
<param name="target" value="System.err"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %d [%t][%F:%L] : %m%n" />
</layout>
</appender>
<!-- the root category -->
<!--
all log messages of level "debug" or higher will be logged, unless defined otherwise
all log messages will be logged to the appender "stdout", unless defined otherwise
-->
<root>
<priority value="ALL"/>
<appender-ref ref="stdout" />
<appender-ref ref="stderr" />
</root>
</log4j:configuration>
computer:~ ~$ export DISPLAY=172.18.146.250:0 computer:~ ~$ xhost + xhost: unable to open display "172.18.146.250:0" computer:~ ~$Thats not right... lets start the Xserver in background (X Server startcmd is 'X').... and do this again...
computer:~ ~$ X &
launch_msg("CheckIn") IPC failure: Operation not permitted
Xquartz: Unable to locate waiting server: org.x.X11
Xquartz: X11.app = /Applications/Utilities/X11.app/Contents/MacOS/X11
Xquartz: Starting X server: /Applications/Utilities/X11.app/Contents/MacOS/X11 --listenonly
..SCM BUILD BOX profile been setup..
================================================
X11.app: main(): argc=2
argv[0] = /Applications/Utilities/X11.app/Contents/MacOS/X11.bin
argv[1] = --listenonly
Waiting for startup parameters via Mach IPC.
X11.app: No launchd socket handed off, unsetting DISPLAY
X11.app: do_start_x11_server(): argc=1
argv[0] = X
Xquartz starting:
X.Org X Server 1.4.2-apple56
Build Date: 20100624
(EE) XKB: Couldn't open rules file /usr/X11/share/X11/xkb/rules/base
(EE) XKB: Couldn't open rules file /usr/X11/share/X11/xkb/rules/base
computer:~ ~$
Try 2:
Now open the xterm under the X11 Application that has been started...
bash-3.2$ export DISPLAY=172.18.146.250:0 bash-3.2$ xhost + access control disabled, clients can connect from any host bash-3.2$
[wev@wad03 logs]$ /usr/sbin/lsof -p 21336 | perl -MData::Dumper -ne 'BEGIN { my %x=();} {@s=split /\s+/;$x{$s[4]}++;} END { print Dumper(\%x); }'
$VAR1 = {
'IPv6' => 3,
'unix' => 1,
'DIR' => 2,
'TYPE' => 1,
'CHR' => 4,
'0000' => 1,
'REG' => 463,
'sock' => 1
};
[wev@wad03 logs]$
$ find . -type f -name '*.pdf' |
perl -ne 'BEGIN { my @c=() }
{ push @c, $_;$_=undef; }
END {my $n=65; foreach (@c)
{ chomp; $x=$x.sprintf " %c=\"%s\"", $n,$_;$y=$y. sprintf " %c", $n; $n++
};
print "\npdftk $x shuffle $y output collated.pdf;\n"
}'
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>Kinesis</vendorname>
<vendorid>0x0d3d</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>Classic</productname>
<productid>0x001</productid>
</deviceproductdef>
<appdef>
<appname>com.apple.finder</appname>
<equal>com.apple.finder</equal>
</appdef>
<appdef>
<appname>RDC</appname>
<equal>com.microsoft.rdc</equal>
</appdef>
<appdef>
<appname>TERMINAL</appname>
<equal>com.apple.Terminal</equal>
</appdef>
<item>
<name>Kinesis Bindings</name>
<identifier>private.deviceproductdef</identifier>
<device_only>DeviceVendor::Kinesis, DeviceProduct::Classic
</device_only>
<list>
<item>
<name>Keys for Kinesis</name>
<not>TERMINAL</not>
<not>RDC</not>
<!-- Change the Kinesis Alt, TAB / Command to TAB -->
<autogen>--KeyToKey-- KeyCode::TAB, ModifierFlag::OPTION_R,
KeyCode::TAB, ModifierFlag::COMMAND_R
</autogen>
<!-- Change the Kinesis Alt, LeftArrow / Spaces Ctrl LeftArrow -->
<autogen>--KeyToKey-- KeyCode::CURSOR_LEFT, ModifierFlag::OPTION_R,
KeyCode::CURSOR_LEFT, ModifierFlag::CONTROL_R
</autogen>
<autogen>--KeyToKey-- KeyCode::CURSOR_RIGHT, ModifierFlag::OPTION_R,
KeyCode::CURSOR_RIGHT, ModifierFlag::CONTROL_R
</autogen>
<!-- Change the Kinesis Ctrl-END / Ctrl-HOME to HOME or END -->
<autogen>--KeyToKey-- KeyCode::HOME, ModifierFlag::COMMAND_R,
KeyCode::HOME, ModifierFlag::FN
</autogen>
<autogen>--KeyToKey-- KeyCode::END, ModifierFlag::COMMAND_R,
KeyCode::END, ModifierFlag::FN
</autogen>
<!-- Change the Kinesis END and HOME key to go to the begin and end of a
line -->
<autogen>--KeyToKey-- KeyCode::HOME, KeyCode::CURSOR_LEFT,
ModifierFlag::COMMAND_L
</autogen>
<autogen>--KeyToKey-- KeyCode::END, KeyCode::CURSOR_RIGHT,
ModifierFlag::COMMAND_R
</autogen>
<!-- Change the Kinesis Alt-Left and Alt-Right key to go to forward or backwards
one word -->
<autogen>--KeyToKey-- KeyCode::CURSOR_LEFT, ModifierFlag::COMMAND_R,
KeyCode::CURSOR_LEFT, ModifierFlag::OPTION_L
</autogen>
<autogen>--KeyToKey-- KeyCode::CURSOR_RIGHT, ModifierFlag::COMMAND_R,
KeyCode::CURSOR_RIGHT, ModifierFlag::OPTION_R
</autogen>
<!-- Change the Kinesis Ctrls to Command buttons -->
<autogen>--KeyToKey-- KeyCode::CONTROL_L, KeyCode::COMMAND_L
</autogen>
<!-- Change the Kinesis Ctrls to Command buttons -->
<autogen>--KeyToKey-- KeyCode::CONTROL_R, KeyCode::COMMAND_R
</autogen>
</item>
<item>
<name>Kinesis Command Key under Alt for Terminal only</name>
<only>TERMINAL</only>
<autogen>--KeyToKey-- KeyCode::OPTION_R, KeyCode::COMMAND_R</autogen>
</item>
</list>
</item>
</root>
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>Kinesis</vendorname>
<vendorid>0x0d3d</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>Classic</productname>
<productid>0x001</productid>
</deviceproductdef>
<appdef>
<appname>com.apple.finder</appname>
<equal>com.apple.finder</equal>
</appdef>
<appdef>
<appname>RDC</appname>
<equal>com.microsoft.rdc</equal>
</appdef>
<appdef>
<appname>ECLIPSE</appname>
<equal>org.eclipse.eclipse</equal>
</appdef>
<appdef>
<appname>TERMINAL</appname>
<equal>com.apple.Terminal</equal>
</appdef>
<item>
<name>Kinesis Bindings</name>
<device_only>DeviceVendor::Kinesis, DeviceProduct::Classic</device_only>
<item>
<name>Keys for Kinesis</name>
<appendix>Keys for Kinesis Keyboard on MacOSX</appendix>
<not>TERMINAL</not>
<not>RDC</not>
<identifier>kinesis.mapping.basic</identifier>
<!-- Change the Kinesis Alt, TAB / Command to TAB -->
<autogen>__KeyToKey__ KeyCode::TAB, ModifierFlag::OPTION_R,
KeyCode::TAB, ModifierFlag::COMMAND_R
</autogen>
<!-- Change the Kinesis Alt, LeftArrow / Spaces Ctrl LeftArrow -->
<autogen>__KeyToKey__ KeyCode::CURSOR_LEFT, ModifierFlag::OPTION_R,
KeyCode::CURSOR_LEFT, ModifierFlag::CONTROL_R
</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_RIGHT, ModifierFlag::OPTION_R,
KeyCode::CURSOR_RIGHT, ModifierFlag::CONTROL_R
</autogen>
<!-- Change the Kinesis Ctrl-END / Ctrl-HOME to HOME or END -->
<autogen>__KeyToKey__ KeyCode::HOME, ModifierFlag::COMMAND_R,
KeyCode::HOME, ModifierFlag::FN
</autogen>
<autogen>__KeyToKey__ KeyCode::END, ModifierFlag::COMMAND_R,
KeyCode::END, ModifierFlag::FN
</autogen>
<!-- Change the Kinesis END and HOME key to go to the begin and end of
a line -->
<autogen>__KeyToKey__ KeyCode::HOME, KeyCode::CURSOR_LEFT,
ModifierFlag::COMMAND_L
</autogen>
<autogen>__KeyToKey__ KeyCode::END, KeyCode::CURSOR_RIGHT,
ModifierFlag::COMMAND_R
</autogen>
<!-- Change the Kinesis Alt-Left and Alt-Right key to go to forward or
backwards one word -->
<autogen>__KeyToKey__ KeyCode::CURSOR_LEFT, ModifierFlag::COMMAND_R,
KeyCode::CURSOR_LEFT, ModifierFlag::OPTION_L
</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_RIGHT, ModifierFlag::COMMAND_R,
KeyCode::CURSOR_RIGHT, ModifierFlag::OPTION_R
</autogen>
<!-- Change the Kinesis Ctrls to Command buttons -->
<autogen>__KeyToKey__ KeyCode::CONTROL_L, KeyCode::COMMAND_L
</autogen>
<!-- Change the Kinesis Ctrls to Command buttons -->
<autogen>__KeyToKey__ KeyCode::CONTROL_R, KeyCode::COMMAND_R
</autogen>
</item>
<item>
<name>Kinesis Command Key under Alt for Terminal only</name>
<only>TERMINAL</only>
<identifier>kinesis.terminal</identifier>
<autogen>__KeyToKey__ KeyCode::K, VK_OPTION,
KeyCode::EQUAL, ModifierFlag::CONTROL_R</autogen>
<!-- Change the Kinesis Ctrls to Command buttons -->
<autogen>__KeyToKey__ KeyCode::CONTROL_R, KeyCode::COMMAND_R
</autogen>
</item>
<item>
<name>Kinesis Command Key under Alt for Eclipse only</name>
<only>ECLIPSE</only>
<identifier>kinesis.eclipse</identifier>
<!-- Change the Kinesis Ctrl - Space to buttons -->
<autogen>__KeyToKey__ KeyCode::SPACE, VK_COMMAND,
KeyCode::SPACE, ModifierFlag::CONTROL_L </autogen>
</item>
<!--
org.eclipse.eclipse
-->
</item>
</root>