#!/bin/sh
echo "Content-type: text/html\n"
echo ""
CISCO=`echo "$QUERY_STRING" | sed -n 's/^.*router=\([^&]*\).*$/\1/p'`
MONTH=`echo "$QUERY_STRING" | sed -n 's/^.*month=\([^&]*\).*$/\1/p'`
DAY=`echo "$QUERY_STRING" | sed -n 's/^.*day=\([^&]*\).*$/\1/p'`
PMONTH=`date +%m`
PDAY=`date +%d`
if [ $MONTH = $PMONTH ] && [ $DAY = $PDAY ] ; then
SYSLOG="cat braslog"
else
SYSLOG="zcat braslog.$MONTH.$DAY.gz"
fi
SHOUR=`echo "$QUERY_STRING" | sed -n 's/^.*shour=\([^&]*\).*$/\1/p'`
SMINUTE=`echo "$QUERY_STRING" | sed -n 's/^.*sminute=\([^&]*\).*$/\1/p'`
EHOUR=`echo "$QUERY_STRING" | sed -n 's/^.*ehour=\([^&]*\).*$/\1/p'`
EMINUTE=`echo "$QUERY_STRING" | sed -n 's/^.*eminute=\([^&]*\).*$/\1/p'`
STIME="$SHOUR:$SMINUTE"
ETIME="$EHOUR:$EMINUTE"
STRING=`echo "$QUERY_STRING" | sed -n 's/^.*string=\([^&]*\).*$/\1/p' | \
sed -e "s/+/ /g" -e "s/%22/\"/g" -e "s/%2C/,/g" -e "s/%2F/\//g" -e "s/%3A/\:/g" -e "s/%26/\&/g" -e "s/%7C/|/g"`
echo "<html>"
echo "<body>"
if [ -z "$STRING" ] ; then
results=`$SYSLOG | egrep "$CISCO" | nawk '$3>=from&&$3<=to' from="$STIME" to="$ETIME" | nawk 'sub("$", "<br>")'`
else
results=`$SYSLOG | egrep "$," | egrep -i "$STRING" | awk '$3>=from&&$3<=to' from="$STIME" to="$ETIME" | nawk 'sub("$", "<br>")'`
fi
echo $results
echo "</body></html>"
---------- Post updated at 05:15 PM ---------- Previous update was at 04:10 PM ----------
I wanted to add the router= string will change on each submission. Sometimes just one router and other times there will be many. Each with a different router name.
---------- Post updated at 07:41 PM ---------- Previous update was at 05:15 PM ----------
I found a rather crude way of putting my multiple same prefix strings in a file. Any suggestions to clean this up?
Hi folks,
I have the following parameter setting:
export ADMIN_HOST_NAME=http://hostname.com
I want to define a new parameter,ADMIN_HOST_NAME_NEW,which based on $ADMIN_HOST_NAME but I need to remove the prefix "http://".
The requested result for $ADMIN_HOST_NAME_NEW is hostname.com
How... (2 Replies)
Hi all,
I have a requirement where in i have to create a temporary file by prefixing a string of special characters to each row of a input file.
the input file is '|' delimited.
here is the content of input file
aaa|1234|axad|123
bbb|qwqw|qw|1334
the output should be
... (5 Replies)
I have a file:
chromosome1:436728
chromosome2:32892
.....
chromosome22:23781
I just want to get the number, not the prefix "chromosomeX", so I want to remove all the prefix ahead of the numbers. How can I do that?? Thanks!!! (PS: give me some very simple command so that I can understand... (4 Replies)
I have a variable embedded in a long string called "commands" coming in on a query_string. I need to copy the string to a file with the variable $loop1 converted before it writes. Right now, it writes the varible itself instead of what it should be.
QUERY_STRING... (2 Replies)
Hi Guys,
I wonder how can I determine when a given number is a multiple of another one in java. Let's say if I have 27 how can I determine whether is multiple of 5 using java programming. Thanks. (1 Reply)
Hi, I'm new about shell scripting, and I need to do something like
abcd **1234** efgh
by
abcd '''1234''' efgh
I know that command sed helps about change one string by another, but I dont know how to keep whatever is inside **_** and replace * with '.
Thanks! (5 Replies)
Possible filenames:
CDD_Whatever.txt
DDD_Whatever.txt
If the file prefix = CDD, I'd like to prefix every person ID (second column in my examples below) on the file with "c-"
If the file prefix = DDD, I'd like to prefix ever person ID with "d-"
Input:
Desired Output:
Any help... (2 Replies)
Hello everyone,
I want to remove only prefix ME_ from all the values that are present in the FILEA. Below code I'm using for this.
sed 's/ME\_//g' FILEA > FILEB
Using the above code, all ME_ values are getting removed from the file. But the problem here is I want to remove only Prefix ME_... (4 Replies)
Dear All,
assume i have a file with content:
<Start>6000</Start>
<Stop>7599</Stop>
the output is:
6000
7000
7100
7200
7300
7400
7599
how should we use any awk, sed, perl can do this task, means to extract the uniq prefixes from the start and stop prefix.
Thanks
Jimmy (3 Replies)
Discussion started by: jimmy_y
3 Replies
LEARN ABOUT NETBSD
column
COLUMN(1) BSD General Commands Manual COLUMN(1)NAME
column -- columnate lists
SYNOPSIS
column [-tx] [-c columns] [-s sep] [file ...]
DESCRIPTION
The column utility formats its input into multiple columns. Rows are filled before columns. Input is taken from file operands, or, by
default, from the standard input. Empty lines are ignored.
The options are as follows:
-c Output is formatted for a display columns wide.
-s Specify a set of characters to be used to delimit columns for the -t option.
-t Determine the number of columns the input contains and create a table. Columns are delimited with whitespace, by default, or with
the characters supplied using the -s option. Useful for pretty-printing displays.
-x Fill columns before filling rows.
column exits 0 on success, >0 if an error occurred.
ENVIRONMENT
COLUMNS The environment variable COLUMNS is used to determine the size of the screen if no other information is available.
EXAMPLES
(echo "PERM LINKS OWNER GROUP SIZE MONTH DAY HH:MM/YEAR NAME";
ls -l | sed 1d) | column -t
SEE ALSO colrm(1), ls(1), paste(1), sort(1)HISTORY
The column command appeared in 4.3BSD-Reno.
BSD March 9, 2008 BSD