Results 1 to 2 of 2

Thread: How to write something on a text file on a certain line?

  1. #1
    Join Date
    Aug 2010
    Posts
    107
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to write something on a text file on a certain line?

    This is how i write something on text file:
    Qt Code:
    1. {system("echo \"Hello\" > /home/$USER/.config/Wallch/Checks/language_selection");
    To copy to clipboard, switch view to plain text mode 

    But how to write something on a certain line without changing the others?
    For example how can i write "Hello" on the third line of my text file without changing the first line... ?

  2. #2
    Join Date
    Aug 2010
    Posts
    107
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to write something on a text file on a certain line?

    ok solved:
    sed -i "4i\Hello" file_here

    while 4 is the line

Similar Threads

  1. Write one value per line in text file
    By babygal in forum Newbie
    Replies: 11
    Last Post: 1st December 2010, 06:47
  2. How to write ByteArray into a text file?
    By babygal in forum Newbie
    Replies: 4
    Last Post: 11th October 2010, 04:19
  3. Remove a line in a text file
    By jaca in forum Newbie
    Replies: 1
    Last Post: 18th March 2010, 22:13
  4. How to write something in line of txt file
    By Zergi in forum Qt Programming
    Replies: 2
    Last Post: 24th December 2007, 10:02
  5. Replies: 2
    Last Post: 17th November 2006, 11:25

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.