Code:
sed -e 's@\(.*port \([0-9]*\) +.*\)@\2@g' filename
that actually diplays the whole file but on the line with port all it displays is the port example below
#! /bin/bash
function savelog
{
echo saving log
DATE=$(date +%Y%m%d%H%M)
LOGSAVE=qconsole-$DATE.log
# ensure file does not exist
while [ -e $LOGSAVE ]; do
DATE=$DATE1
LOGSAVE=qconsole-$DATE.log
done
echo moving $LOGDIR/qconsole.log to $LOGDIR/$LOGSAVE
mv $LOGDIR/qconsole.log $LOGDIR/$LOGSAVE
}
LOGDIR=logs/main
touch loop
if [ -e $LOGDIR/qconsole.log ]; then
savelog;
fi
while [ -e loop ]; do
14200
savelog
done
so as you can see it got rid of the info around it but how can i get rid of rest and just keep that number