Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, I am trying to appending additional text to every line in a text file, can anyone advise me how to construct a ksh script, thanks! a.txt ------ 045345 23455 ...
  1. #1
    Just Joined!
    Join Date
    Feb 2007
    Posts
    14

    Appending text to the lines in the file

    Hi,

    I am trying to appending additional text to every line in a text file, can anyone advise me how to construct a ksh script, thanks!

    a.txt
    ------
    045345
    23455

    i want to append "My menu id is :" to every line in a.txt. Desire result:

    a.txt
    -----
    My menu id is : 045345
    My menu id is : 23455

    Thanks

  2. #2
    Linux User
    Join Date
    Aug 2006
    Posts
    458
    Code:
    sed  's/^/My Id is: /' file > newfile
    Code:
    awk '{print "My id is "$0}' file > newfile

  3. #3
    Just Joined!
    Join Date
    Feb 2007
    Posts
    14
    Thanks a lot! It is working

Posting Permissions

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