#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2002
    Posts
    135
    Rep Power
    12

    shell script help to facilate the faxing


    dBase Reader and Converter V. 0.6, (c) 2002 - 2003 by Bjoern Berg
    FAXNAME: LA COMPUTER COMPONEN
    FAXTEL: 23020834
    FAX_GROUP:
    FAX_DESCP:

    FAXNAME: MUSTANG COMPUTER TEC
    FAXTEL: 23110692
    FAX_GROUP:
    FAX_DESCP:

    FAXNAME: MANDARIN COMPUTERISE
    FAXTEL: 23111720
    FAX_GROUP:
    FAX_DESCP:


    ....

    File CO_01.DBF was closed successfully.

    need to take away the first and last line as well as the faxname ...etc
    except the faxno so

    11111111
    22222222
    33333333
    44444444

    in such fashion.

    can u help, please.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    137
    Rep Power
    0
    From the command line you could do:

    grep FAXTEL <xx_zz.DBF> | awk '{ print $2 }'

    If it needs to go to an out file:

    grep FAXTEL <xx_zz.DBF> | awk '{ print $2 }' > <name.outfile>

    If you want to script this (called the script tel_from_fax):
    Code:
    #!/bin/bash
    #
    # tel_from_fax <infile> <outfile>
    #
    # infile must be given
    # outfile is optional (if none given: fax_tel_only.<yymmdd>)
    
    INFILE="$1"
    OUTFILE="$2"
    
    [[ -z ${INFILE} ]] && echo "No input file given. Quiting" && exit 1
    [[ -z ${OUTFILE} ]] && OUTFILE="fax_tel_only.`date '+%y%m%d'`"
    
    grep FAXTEL ${INFILE} | awk '{ print $2 }' > ${OUTFILE}

IMN logo majestic logo threadwatch logo seochat tools logo