Read and Edit Text Files

I wanted to find out if there is a way to read linux
configuration files, edit parameters in them and save them using
coldfusion. I know PHP has the capability to do this, but I don't
know if CF does and how powerful it is.

If it's plain text, just write it into a textarea and let
your users edit it there. When they submit, use cffile to overwrite
the text file.
There are other ways to allow users to edit text in a web
app, such as the "contenteditable" attribute in IE, but the basic
idea remains the same.
Or do you mean that the app will alter the files
automatically? If that's the case, then regular expressions would
likely be the way to go.

Similar Messages

  • Reading and Editing '.pdb' files in Mac OS X

    Does anyone know of a program that will read and edit '.pdb' files in Mac OS X? eReader Pro doesn't allowing editing. Thanks.

    Did you try PalmFileEdit?
    http://www.ecamm.com/mac/palmfileedit/

  • Read and Write Text Files

    How do I add text from an input text box from flash to a text
    (.doc) file when you press an OK button. I want to make the button
    have an:
    on (release) {
    //script
    Lets say the URL is "/scene_detail.doc". I can also use .txt
    files, but I'd much prefer someone to tell me how to do this with
    DOC files. Thanks in Advanced!

    Flash cannot write files. You must have some sort of
    serverside script do
    this, something like ColdFusion, php, asp, perl or cgi.
    There is a sample here that writes to an XML file with php:
    http://www.kirupa.com/web/xml_guestbook.htm
    Here is one that writes to a text file with perl:
    http://www.flash-db.com/PerlTut/
    Another sample:
    http://actionscript.org/forums/showpost.php3?p=421960&postcount=70
    Dan Mode
    ->Adobe Community Expert
    *Flash Helps*
    http://www.smithmediafusion.com/blog/?cat=11
    *THE online Radio*
    http://www.tornadostream.com
    *Must Read*
    http://www.smithmediafusion.com/blog
    "DjSickNick" <[email protected]> wrote in
    message
    news:eaou83$a31$[email protected]..
    > How do I add text from an input text box from flash to a
    text (.doc) file
    > when
    > you press an OK button. I want to make the button have
    an:
    > on (release) {
    > //script
    > }
    > Lets say the URL is "/scene_detail.doc". I can also use
    .txt files, but
    > I'd
    > much prefer someone to tell me how to do this with DOC
    files. Thanks in
    > Advanced!
    >

  • Will PS express on Win.8.1 read and edit a PSD file?

    Hi, I am trying to find a reliable program to open PSD files for a business card i have had created. I may want to change the verbage around on the template. I searched the microsoft store for programs and PH express came up but did not describe if the program will read and edit PSD files.
    Can anyone provide some feed back on this?
    Or provide another option besides purchasing PS?
    Thank you.

    Updated: i installed PS express and shocker... it doesnt evan acknowledge the PSD file in my folder.
    so i read somewhere that i may be able to edit a PSD with an older version of photshop., but i am running Win. 8.1 ...
    can someone suggest a older more echonomical version of PS that will read and edit PSDs???
    need help... thank you.

  • Read and edit a txt file in Air 2.5

    im building an android application, the database i have to use is a txt file, on the device file system
    i tryed many codes from the internet but none of them worked.
    can someone write an example code of how to read and edit this file?
    im a beginner so it would be helpful if you be more detaied....
    thanks.

    Please let me know if it is possible to do like this.
    All suggestions are welcome.Find out yourself by using Google.

  • HOW TO WRITE AND READ FROM A TEXT FILE???

    How can I read from a text file and then display the contents in a JTextArea??????
    Also how can I write the contents of a JTextArea to a text file.
    Extra Question::::::: Is it possible to write records to a text file. If you have not idea what I am talking about then ignore it.
    Manny thanks,
    your help is much appreciated though you don't know it!

    Do 3 things.
    -- Look through the API at the java.io package.
    -- Search previous posts for "read write from text file"
    -- Search java.sun.com for information on the java.io package.
    That should clear just about everything up. If you have more specific problems, feel free to come back and post them.

  • Select and edit text Adobe Reader 8.1.2 & Mac OS10.5

    How does one select and edit text in a PDF Adobe Read document with Mac OS 10.5? Step by step directions would be appreciated.

    Wasn't sure since this isn't the Reader forum.
    No. Can't do that then.

  • Help with reading in a text file and arrays

    I need to read in a text file with info like this for example
    dave
    martha
    dave
    billy
    I can read the information into an array and display the names but what I need to do is display how many times the same name is in the file for example the output should be
    dave 2
    martha 1
    billy 1
    How can I accomplish this? Would I use a Compareto Method to find
    duplicate names?

    Hi,
    I would recommend storing them in a Hashtable.. something like this:
    Hashtable names = new Hashtable() ;
    String s ;
    while( ( s = bufferedReader.readLine() ) != null ) {
        if ( names.contains( s ) ) {
           names.put( s , new Integer( names.get(s)+1 ) ) ;
        else {
           names.put( s , new Integer( 1 ) ) ;
    }Then the hashtable will contain a set of keys and values, which are the names and counts respectively.
    Kenny

  • Read and write from and to text file

     Hi All,
    I am trying to read some portion of a text file and make measurement and calculation with those numbers and write back to the same text file and also to a excel file. I need to create a 2 D  array of 20 by 20 from the text file values and write to front panel table and to text file. but I am having problem with it, obviously I am new to this. Please help me.  thanks much
    ~ Johnny

    Hi Lynn,
    the requirement is to move C1 and C2 to each position that is given in the text file in steps and percentage value.
    for example C1 has to go to first step (5%) and C2 has to go thru all steps, 5% to 95% , in 5 percent increment. 
    each 100 steps translates to 1 percent increment in the capacitor value.
    at the end, I need to enter the measured data (values of C1 for each step, vesus all values of C2 for all steps) and enter them at the bottom of the text file's table where it starts at : "IMPEDANCE_REAL in Ohmone line per C1 position, containing all values for the different C2 positions" and do the same for where it says "IMPEDANCE_IMAGINARY in Ohmone line per C1 position, containing all values for the different C2 positions"
    the reason I read the file twice, is that if it read it once, I couldn't connect it to spreadsheet string to array vi.
    as you can see, I also like to use the write to measurement file and build table express vi's to display the table on the front panel and save the data to ni data file format so later I convert it to excel  too.
    any thoughts?
    thanks for your help
    ~ Johnny
    Attachments:
    read from text2.vi ‏82 KB

  • Reading through a text file and then sorting

    I'm having a lot of problems with this.
    I have to read through a text file and I have to split the string up so that it is seperated into individual tokens. A line from the text file looks like this. addEvent(new Bell(tm + 9000)). I have to grab the addEvent, new, Bell, tm and 9000 and store it in a linkedlist. After reading through the whole text file I have to sort the the linked list based on the number. ie: 9000. Is there any way to do this? I currently break up the text file using a StringTokenizer object but then i am uncertain on how to add it to a linked list and then sort each line based on the number. Any help would be appreciated.
    Joe

    Sorry to bother you Ben but I just can't get my head wrapped around this. Here is exactly what I have to do:
    After reading, Events must be stored in the EventSet according to the time they are to occur. Assume that no time number is more than 8 digits long. Restart() must be able to deal appropriately with any order of the Events. To accomplish this have Restart() save the relevant Event information in an LinkedList of strings and sort the Events by time before adding each event to EventSet. Use the <list>.add() to set up your linked list. This is shown in c09:List1.java and Collections.sort(<list>) shown in c09:ListSortSearch. Modify the Bell() to output a single "Bing!". When you read in a Bell event generate the appropriate number of Bell events as indicated by rings. These must be set to the correct times. This is an alternative to generating the new Bell events within Bell(). It will allow them be sorted into their correct time sequence. At this point the output of the program should be identical the original program.
    After the intitial start, when restarting Restart() must provide to the user the option to recreate the EventSet from the linked list or read in a new file (supplied by the user). This must be achieved by prompting the user at the console. Please also allow the user the option to quit the program at this stage.
    Main Program Code:
    public class GreenhouseControls extends Controller
    private boolean light = false;
    private boolean water = false;
    private String thermostat = "Day";
    private boolean fans = false;
         private class FansOn extends Event
              public FansOn(long eventTime)
                   super(eventTime);
              public void action()
              // Put hardware control code here to
              // physically turn on the Fans.
              fans = true;
              public String description()
                   return "Fan is On";
         private class FansOff extends Event
              public FansOff(long eventTime)
                   super(eventTime);
              public void action()
              // Put hardware control code here to
              // physically turn off the Fans.
              fans = false;
              public String description()
                   return "Fans are Off";
         private class LightOn extends Event
              public LightOn(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here to
                   // physically turn on the light.
                   light = true;
              public String description()
                   return "Light is on";
         private class LightOff extends Event
              public LightOff(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here to
                   // physically turn off the light.
                   light = false;
              public String description()
                   return "Light is off";
         private class WaterOn extends Event
              public WaterOn(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here
                   water = true;
              public String description()
                   return "Greenhouse water is on";
         private class WaterOff extends Event
              public WaterOff(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here
                   water = false;
              public String description()
                   return "Greenhouse water is off";
         private class ThermostatNight extends Event
              public ThermostatNight(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here
                   thermostat = "Night";
              public String description()
                   return "Thermostat on night setting";
         private class ThermostatDay extends Event
              public ThermostatDay(long eventTime)
                   super(eventTime);
              public void action()
                   // Put hardware control code here
                   thermostat = "Day";
              public String description()
                   return "Thermostat on day setting";
         // An example of an action() that inserts a
         // new one of itself into the event list:
         private int rings;
         private class Bell extends Event
              public Bell(long eventTime)
                   super(eventTime);
              public void action()
                   // Ring every 2 seconds, 'rings' times:
                   System.out.println("Bing!");
                   if(--rings > 0)
              addEvent(new Bell(System.currentTimeMillis() + 2000));
              public String description()
                   return "Ring bell";
         private class Restart extends Event
              public Restart(long eventTime)
                   super(eventTime);
              public void action()      
                   long tm = System.currentTimeMillis();
                   // Instead of hard-wiring, you could parse
                   // configuration information from a text
                   // file here:
              try
              BufferedReader in = new BufferedReader(new FileReader("Event Config.txt"));
              String str;
                   String[] l1 = new String[5];
                   LinkedList l2 = new LinkedList();
              while((str = in.readLine()) != null )
                        StringTokenizer st = new StringTokenizer(str, "(+); ");
                        int nIndex = 0;
                        while (st.hasMoreTokens())
                             l1[nIndex] = st.nextToken();
                        //System.out.println(st.nextToken());
                             nIndex++;
                        l2.add(l1);
                   String[] s1 = (String[])l2.get(1);
                   for(int i = 0; i < s1.length; i++)
                        System.out.println(s1);
                   Comparator comp = s1[4];
                   Collections.sort(l2, comp);
              in.close();
              catch (IOException e)
    rings = 5;
    addEvent(new ThermostatNight(tm));
    addEvent(new LightOn(tm + 1000));
    addEvent(new LightOff(tm + 2000));
    addEvent(new WaterOn(tm + 3000));
    addEvent(new WaterOff(tm + 8000));
    addEvent(new Bell(tm + 9000));
    addEvent(new ThermostatDay(tm + 10000));
    // Can even add a Restart object!
    addEvent(new Restart(tm + 20000));*/
    public String description() {
    return "Restarting system";
    public static void main(String[] args) {
    GreenhouseControls gc =
    new GreenhouseControls();
    long tm = System.currentTimeMillis();
    gc.addEvent(gc.new Restart(tm));
    gc.run();
    } ///:~
    Examples File:
    addEvent(new ThermostatNight(tm));
    addEvent(new Bell(tm + 9000));
    addEvent(new Restart(tm + 20000));
    addEvent(new LightOn(tm + 1000));
    addEvent(new WaterOn(tm + 3000));
    rings = 5;
    addEvent(new FansOn(tm + 4000));
    addEvent(new LightOff(tm + 2000));
    addEvent(new FansOff(tm + 6000));
    addEvent(new WaterOff(tm + 8000));
    addEvent(new WindowMalfunction(tm + 15000));
    addEvent(new ThermostatDay(tm + 10000));
    EventSet.java Code:
    // This is just a way to hold Event objects.
    class EventSet {
    private Event[] events = new Event[100];
    private int index = 0;
    private int next = 0;
    public void add(Event e) {
    if(index >= events.length)
    return; // (In real life, throw exception)
    events[index++] = e;
    public Event getNext() {
    boolean looped = false;
    int start = next;
    do {
    next = (next + 1) % events.length;
    // See if it has looped to the beginning:
    if(start == next) looped = true;
    // If it loops past start, the list
    // is empty:
    if((next == (start + 1) % events.length)
    && looped)
    return null;
    } while(events[next] == null);
    return events[next];
    public void removeCurrent() {
    events[next] = null;
    public class Controller {
    private EventSet es = new EventSet();
    public void addEvent(Event c) { es.add(c); }
    public void run() {
    Event e;
    while((e = es.getNext()) != null) {
    if(e.ready()) {
    e.action();
    System.out.println(e.description());
    es.removeCurrent();
    } ///:~
    Event.java Code
    abstract public class Event {
    private long evtTime;
    public Event(long eventTime) {
    evtTime = eventTime;
    public boolean ready() {
    return System.currentTimeMillis() >= evtTime;
    abstract public void action();
    abstract public String description();
    } ///:~
    Is this problem easier than I think it is? I just don't know what to add to the linkedList. A LinkedList within a linkedList? I find this problem pretty difficult. Any help is muchly appreciated.
    Joe

  • Help needed regarding reading in a text file and tokenizing strings.

    Hello, I require help with a task I've been set, which asks me to read in a text file, and check the contents for errors. The text file contains lines as follows.
    surname:forename:1234:01-02-06
    I can read in the file, but dont know how to split the strings so each token can be tested (ie numbers in the name tokens)
    However, I am not allowed to use regex functions, only those found in java.io.*
    I think i should be putting the tokens into an array, but have had no luck so far in doing so. Any help would be appreciated.

    public class Validator {
         public static void main(String args[]) {
              String string = "Suname:Forename:1234:01_02-06";
              String stringArray[] = string.split(":");
              System.out.println (validateLetters(stringArray[0]));//returns true
              System.out.println (validateNumbers(stringArray[3]));//returns false
         static boolean validateLetters(String s) {
                 for(int i = 0; i < s.length(); i++) {
                 char c = s.charAt(i);
                 if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z')) {
                         return false; //return false if one of characters is other than a-z A-Z
                 }//end if
                 }//end for
                 return true;
         }//end validateLetters
         static boolean validateNumbers(String s) {
                 for(int i = 0; i < s.length(); i++) {
                 char c = s.charAt(i);
                 if ((c < '0' || c > '9') && (c != '-')) {
                         return false; //return false if one of characters is other than 0-9 or -
                 }//end if
                 }//end for
                 return true;
         }//end validateNumbers
    }

  • Read and Edit a PDF File

    Dear Friends,
    I would like to know if it is possible to read and edit the same pdf file using Java. ie my PDF file named "Sample.pdf" has contents like
    First Name = &F_NAME
    Last Name =&L_NAME
    what I want is to parse the Sample.pdf file and look for &F_NAME and replace it with "Jacob" and &L_NAME and replace it with "Abraham" so that the contents within that pdf file look like
    First Name = Jacob
    Last Name =Abraham
    Please let me know if it is possible to do like this. All suggestions are welcome. Thanks in advance.

    Please let me know if it is possible to do like this.
    All suggestions are welcome.Find out yourself by using Google.

  • Read in a text file and parse at spaces

    I need to read in a text file, then split it at the spaces (after each word)
    then I would like to save each sentence (maybe as a String Buffer)
    (chek each word to see if a .?! is at the end to determine the end of a sentence)
    Then I need to add the word END to the end of the StringBuffer
    then store each sentence as an element in an arrayList.
    Please Help.

    Cant you just store the entire text file into a really big String, then split it at each "."?
    String text = "";
    //read file into text
    String[] sentences = text.split(".");

  • Remotely editing text files in Windows WinRM/PSExec/Powershell/cmd

    Hi!
    How can I remotely edit a text file in Windows?
    I am running and administering a number of Windows 7 workstations and Windows Server 2012 machines. I would like to be able to remotely edit text files on any of these machines. I can connect to any of these machines via psexec or powershell remoting. I
    can also connect via rdp, but for the workstations I would rather not kick the user off unless I absolutely have to.
    For example, we manage state configuration using
    Salt. Local configuration files are stored in C:/salt/conf. I would like to be able to edit these config files on the fly.
    This question on Stack Overflow covers the same topic, but none of the answers are particularly satisfying. Some of the possible solutions
    are:
    Remote Desktop: as I say, I would rather not have to kick a user off their workstation
    Edit a file over a UNC path: this only works for files on a share, and setting up arbitrary shares for quick edits seems like a bad idea.
    Install some manner of ftp or ssh server on all the target computers. This would certainly work, but it is it necessary with WinRM already active? I feel like installing and configuring extra software across all the machines in my organisation would be
    a last resort.
    Edit with a command line editor (e.g. vim, emacs) over a remote powershell session. This doesn't work. I don't understand the technical details, but a powershell remote session isn't interactive in the same way that ssh connections are.
    Edit using powershell's -replace operator, out-file and add-content cmdlets. This works, but is hardly the same as a fully featured text editor.
    Retrieve content from the remote, edit locally, and post back to the remote. This works, and is arguably the best solution I've found. Code sample from SO:
    PS C:\Users\Meredith> Invoke-Command -Session $ps -ScriptBlock {get-content c:/inetpub/myapp/web.config} > web.config
    edit web config
    PS C:\Users\Meredith> get-content web.config | Invoke-Command -Session $ps -ScriptBlock {set-content c:/inetpub/myapp/web.config}
    The last two options are the workflow that I've been using for now. Regex replacement for very simple changes, and copying to local and editing there for more complicated ones. Neither is ideal, but they work. It just feels incredibly old fashioned.
    I'm considering writing a plugin to my editor of choice (vim) to perform the remote fetch and save, to make my workflow a little bit smoother. Before I try that, I just want to know if there's anything that I've missed, or misunderstood.
    Cheers

    What is the "redirector"?
    I posted the same question to Stack Overflow, and was told about administrative shares. I wasn't aware of this, and it's exactly what I wanted. I can open the filetree of a remote machine with the path \\machinename\c$\. Perfectly simple, now that I know
    the answer.

  • How to read from a text file one character at a time?

    Hello
    I wish to read from a text file in a for loop and that on every iteration i read one charachter and proceed to the next one.
    can anyone help me?
    Lavi 

    lava wrote:
    I wish to read from a text file in a for loop and that on every iteration i read one charachter and proceed to the next one.
    can anyone help me?
    Some additional comments:
    You really don't want to read any file one character at a time, because it is highly inefficient. More typically, you read the entire file into memory with one operation (or at least a large chunk, if the file is gigantic) and then do the rest of the operations in memory.  One easy way to analyze it one byte at a time would be to use "string to byte array" and then autoindex into a FOR loop, for example.
    Of course you could also read the file directly as a U8 array instead of a string.
    Message Edited by altenbach on 06-10-2008 08:57 AM
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for

  • Flash Player keeps failing in safari

    I am using mac OS X Yosemite. For some unknown reason flash keeps failing in safari, but works in chrome. I can't seem to resolve this issue, This is what I tried so far from answers I received in the apple support forums: If you can't install or upd

  • Losing Digital Audio Ouput from Mini SPDIF

    I have a 2010 Mac Mini connected to my HDTV/AV Receiver. I send digital audio to the av receiver with an optical cable. I have sleep disabled for OTA DVR. I have not tried to see if it will wake the mini to record. I have it working, but often upon u

  • Is it legal to record software?

    Hi A quick question that I asked many but no-one seems to know. Is it legal to record tutorials for how to use apple's software? I intend to sell access to those courses. Thank you in advance! - Elliott :)

  • Date time conversion

    Someone has exported a CSV file with Date Time field sent as text with 'period' separation. How can I convert from 12.10.2009 10:00:00 to a recognised date time for future date difference calculation? Regards, Brian.

  • Doesn't completely boot up, then restarts

    hi, i'm new here and need someone's help! i have an imac that i bought about 6 months ago. i turn the computer on, i hear the start up tone, the apple sign, and the spinning "gear". it stays like that for a while and then reboots on its own. if you l