transpose-simple: simple transpose with paste

This commit is contained in:
Ole Tange 2013-10-10 11:04:36 +02:00
parent 6ce33622f3
commit 47fffa4239
3 changed files with 8 additions and 11 deletions

View file

@ -16,5 +16,5 @@ timestamp/timestamp.1: timestamp/timestamp
pod2man timestamp/timestamp > timestamp/timestamp.1 pod2man timestamp/timestamp > timestamp/timestamp.1
install: install:
parallel ln -sf `pwd`/{}/{} /usr/local/bin/{} ::: blink reniced em field forever neno rn stdout tracefile w4it-for-port-open upsidedown histogram goodpasswd mtrr not summer timestamp parallel ln -sf `pwd`/{}/{} /usr/local/bin/{} ::: blink reniced em field forever neno rn stdout tracefile w4it-for-port-open upsidedown histogram goodpasswd mtrr not summer timestamp transpose
parallel ln -sf `pwd`/{} /usr/local/share/man/man1/{/} ::: */*.1 parallel ln -sf `pwd`/{} /usr/local/share/man/man1/{/} ::: */*.1

View file

@ -0,0 +1,3 @@
Can it be done more simple?
zcat D.gz | perl -ne 's/\s+/\n/g; open(OUT,">","out".(++$out)); print OUT' ; paste out* | pigz >Dt.gz

View file

@ -3,7 +3,7 @@
HOST=$1 HOST=$1
PORT=$2 PORT=$2
TCPTRACEROUTE=$( which tcptraceroute ) NC=$( which nc )
usage () { usage () {
echo "Usage:" echo "Usage:"
@ -33,13 +33,7 @@ print_up_but_port_closed () {
port_is_open () { port_is_open () {
# If tcptraceroute stops working use: # If tcptraceroute stops working use:
# echo | nc -w 2 $HOST $PORT || failed # echo | nc -w 2 $HOST $PORT || failed
OUT=$(tcptraceroute -f 255 -m 255 -q 1 -w 1 $HOST $PORT 2>&1) if $NC -z -w 2 $HOST $PORT 2>&1 ; then
if echo "$OUT" | grep 'Destination not reached' >/dev/null ; then
print_not_reachable
OPEN=no
elif echo "$OUT" | grep '\[closed\]' >/dev/null ; then
print_up_but_port_closed
sleep 1
OPEN=no OPEN=no
else else
OPEN=yes OPEN=yes
@ -52,8 +46,8 @@ fi
if [ -z "$PORT" ] ; then if [ -z "$PORT" ] ; then
PORT=22 PORT=22
fi fi
if [ -z "$TCPTRACEROUTE" ] ; then if [ -z "$NC" ] ; then
echo "Error, 'tcptraceroute' not installed." echo "Error, 'nc' not installed."
exit 2 exit 2
fi fi