Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I have one file with data in the following order 0x12 0x23 0x34 0x45 I need to append ',' (i.e Comma) at the end of each line. How to ...
  1. #1
    Just Joined!
    Join Date
    Dec 2007
    Posts
    28

    appending data using sed

    Hi,

    I have one file with data in the following order
    0x12
    0x23
    0x34
    0x45

    I need to append ',' (i.e Comma) at the end of each line.
    How to do it using sed?

    can anyone please guide me?

  2. #2
    Linux Newbie
    Join Date
    Jul 2008
    Posts
    181
    sed 's/$/,/' input_file

  3. #3
    Just Joined!
    Join Date
    Dec 2007
    Posts
    28
    Hi,
    Thanks for your mail.
    If I create a file in Vi editor and execute the above command it works. But If i create .txt file in windows and try this command ","(Comma) is placed at the beginning.

    My understanding is $ represents end of line. But why in .txt it is in the beginning?

  4. #4
    Just Joined!
    Join Date
    Dec 2007
    Posts
    28
    Hi ,
    Thanks. I found the cause. it is due to ^M

Posting Permissions

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