Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2007
    Posts
    4

    Red face Unanswered: Need help in Sed Command

    have written a Shell script which will Produce an Output like this ::

    unixytreqasassdd <unix_unix@unix.com> [Date: 2008-05-16]


    I just need to add the Following in the Above which should be of proper lenghts::

    Name Email Address Date

    unixytreqasassdd <unix_unix@unix.com> [Date: 2008-05-16]

    Since the name , email address and Dates of various lenghts , i have make the report user Friendly ..

    I have tried adding an Echo command but didnot work properly . So can anyone help me on this !!!
    Code ::


    sed '
    /'$fld1'/ i\
    Name' temp.txt > man8.txt

    sed '
    /'<'/ i\
    Email Address' man8.txt > man9.txt

    sed '
    /'['/ i\
    Date of Expire' man9.txt > man10.txt

    Please help me on this .. I am in need of a code

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    What should the output look like?

  3. #3
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    It seems you need to prefix the name with the word name
    Why don't you just do that from your original script e.g.
    echo "name: $name"

    If you want fixed length output use printf in your original script e.g.
    Code:
    cat <<EOF | while read n e d
    x y z
    aa bbb cc
    EOF
    do
      printf "%-5s %-10s %-10s\n" $n $e $d
    done
    
    x     y          z         
    aa    bbb        cc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •