[SOLVED] Put two line together (make one line)

Michelle Konzack <[email protected]>
Newsgroups gmane.editors.sed.user
Organization Tamay Dogan Network
Message-ID <20120818180019.GX28928@work1>
Found an old sed1line.txt file and now it works...

----[ '~/bin/find_active_computers' ]-----------------------------------
#!/bin/bash

INPUT="$1"

if [ -n "${INPUT}" ]
then

  SCAN_LIST=`nmap -sP ${INPUT} |sed -e :a -e '$!N;s/\nMAC/MAC/;ta' -e 'P;D' |grep ^Host`
  SRV_NUM=`echo -e "${SCAN_LIST}" |grep ^Host |wc -l`

  echo -e "${SCAN_LIST}" |
  while read LINE
  do

    HOST_IP=`echo -e "${LINE}" |sed 's|^Host \(.*\) is up.*|\1|'`

    echo "${HOST_IP}" |grep --regexp="(" >/dev/null
    if [ $? -eq 0 ]
    then
     IP=`echo     -e "${HOST_IP}" |sed 's|.* (\(.*\)).*|\1|'`
    else
     IP=`echo     -e "${HOST_IP}" |sed 's|^Host \(.*\) .*|\1|'`
    fi

    echo "${HOST_IP}" |grep --regexp="(" >/dev/null
    if [ $? -eq 0 ]
    then
      FQDN=`echo  -e "${HOST_IP}" |sed 's|\(.*\) (.*|\1|'`
    else
      FQDN=${IP}
    fi

    MAC=`echo     -e "${LINE}"    |grep --regexp="MAC" |sed 's|.*MAC Address: \(.*[0-9A-F:]\) .*|\1|'`
    if [ -z "${MAC}" ]
    then
      MAC="active_host"
    fi

    echo "${IP},${FQDN},${MAC}"

  done

fi
------------------------------------------------------------------------



Thanks, Greetings and nice Day/Evening
    Michelle Konzack

-- 
##################### Debian GNU/Linux Consultant ######################
   Development of Intranet and Embedded Systems with Debian GNU/Linux
               Internet Service Provider, Cloud Computing
                <http://www.itsystems.tamay-dogan.net/>

itsystems@tdnet                     Jabber  [email protected]
Owner Michelle Konzack

Gewerbe Strasse 3                   Tel office: +49-176-86004575
77694 Kehl                          Tel mobil:  +49-177-9351947
Germany                             Tel mobil:  +33-6-61925193  (France)

USt-ID:  DE 278 049 239

Linux-User #280138 with the Linux Counter, http://counter.li.org/


[Non-text portions of this message have been removed]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.