Results 1 to 9 of 9

Thread: Text editor suggestion?

  1. #1
    Your very own Pikachu! Banned Peegee's Avatar
    Join Date
    Mar 2001
    Posts
    19,488
    Blog Entries
    81

    Grin Text editor suggestion?

    Say I wanted to append a string to the end of every line and um...prepend a string to each line as well. What editor would you use to make it super duper easy?

    Thanks in advance (also I'm going to check the suggest a program thread right after this)

  2. #2
    I have one of these now Nominus Experse's Avatar
    Join Date
    Jun 2006
    Location
    Here
    Posts
    4,884

    Default

    I don't know if it does what you wish or not, but I have found TED Notepad to have more options than I can list. May wish to check that out.
    ...

  3. #3
    i n v i s i b l e Tech Admin o_O's Avatar
    Join Date
    Jun 2001
    Location
    New Zealand
    Posts
    2,957
    Blog Entries
    1

    FFXIV Character

    Humphrey Squibbles (Sargatanas)

    Default

    Really, there are a million different "advanced text editors" which are mostly capable of the same things, but my choice would be <a href="http://www.scintilla.org">SciTE</a>.

    First you have to hit Ctrl+H to bring up the replace dialog. Second, check the "evaluate backslash expressions" box. Third, replace the text "\r\n" with "[append string]\r\n[prepend string]".

  4. #4
    Very VIP person Tech Admin Rantz's Avatar
    Join Date
    Apr 2006
    Posts
    17,631
    Articles
    1

    Default

    I don't think any editor will make that super duper easy. If you do stuff like that often I recommend learning basic regular expressions and using a tool like SciTE or Notepad++.

    Edit: Actually, it's pretty easy to record a macro in Notepad++ and running a loop on that macro which will do the job.

    Editga: Apparently Notepad++ also has a "column editor" which lets you insert text into all rows on a given column. That makes prepending super duper easy, but it pads the shorter lines if you try to append. There's probably a way around that.
    Last edited by Rantz; 07-19-2008 at 12:33 AM.

  5. #5
    Hypnotising you crono_logical's Avatar
    Join Date
    May 2001
    Location
    Back in Time
    Posts
    9,313
    Contributions
    • Former Administrator
    • Former Cid's Knight

    Default

    Surely this can be done with a simple one line command using sed at a command line? This works for me:

    <pre>sed 's/^.*$/prepend text&append text/' inputfile.txt &gt; result.txt</pre>
    That'd get around the problem of it not altering the first and possibly last lines in the file using face's method
    Problems playing downloaded videos? Try CCCP


  6. #6
    Your very own Pikachu! Banned Peegee's Avatar
    Join Date
    Mar 2001
    Posts
    19,488
    Blog Entries
    81

    Grin

    Quote Originally Posted by crono_logical View Post
    Surely this can be done with a simple one line command using sed at a command line? This works for me:

    <pre>sed 's/^.*$/prepend text&append text/' inputfile.txt &gt; result.txt</pre>
    That'd get around the problem of it not altering the first and possibly last lines in the file using face's method
    I'm getting 'not enough arguments' error.

  7. #7
    Hypnotising you crono_logical's Avatar
    Join Date
    May 2001
    Location
    Back in Time
    Posts
    9,313
    Contributions
    • Former Administrator
    • Former Cid's Knight

    Default

    what OS you trying it on? syntax may vary, but that works in cygwin for me
    Problems playing downloaded videos? Try CCCP


  8. #8
    Your very own Pikachu! Banned Peegee's Avatar
    Join Date
    Mar 2001
    Posts
    19,488
    Blog Entries
    81

    Grin

    Quote Originally Posted by crono_logical View Post
    what OS you trying it on? syntax may vary, but that works in cygwin for me
    windows xp ?

  9. #9
    Hypnotising you crono_logical's Avatar
    Join Date
    May 2001
    Location
    Back in Time
    Posts
    9,313
    Contributions
    • Former Administrator
    • Former Cid's Knight

    Default

    Install cygwin then then try from the cygwin prompt instead of DOS prompt, since I did it from cygwin on WinXP
    Problems playing downloaded videos? Try CCCP


Posting Permissions

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