Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005
    Posts
    1

    Unanswered: adding to each line

    hi!

    i need to add a string to each line of a file.
    i am using
    sed -e 's/$/&,OM6500/g' <$filename>$new_filename

    but this adds the string ",OM6500" to the last line which is a blank line. How can i avoid that.
    as an example, this is what a sample line has right now
    2004-07-16,00:07:00,unknown macAddr,OCLD-NEND,1-OPT-1,0.0,0.0,0.0,0.0,0,0.0,0

    and the line should look like
    2004-07-16,00:07:00,unknown macAddr,OCLD-NEND,1-OPT-1,0.0,0.0,0.0,0.0,0,0.0,0,OM6500

    thanks

  2. #2
    Join Date
    Oct 2003
    Posts
    19
    Hello
    I tried this and it worked
    sed -e 's/$/\,OM6500/g' $filename > $new_filename

    Check it out and let me know .
    Thanks
    Saurav

Posting Permissions

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