How to edit Text Files?

Hi,
I have a text file with sample data like this.
Nokia|25
Motorola|30
LG|20
Samsung|50
Sony|25
I will get an argument like ‘Nokia’. I need to compare it with the data in the file. If I find a matching record in the file, I need to decrement the quantity, i.e 25 in this case(Nokia) and display a message in the screen.
Can someone tell me how this can be achieved?
Thanks.

Thanks for your reply. You have mentioned "When an update happens flush the list of items back to the file. ". If I am going to write it back to the same file, it will get appended right?. I need to update the file. Do you mean to say that i delete the existing file and re-create it and then flush the contents into the file?
I have just started coding in Java. So if incase you feel my question is absurd, please excuse me.

Similar Messages

  • 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 edit *.folio files in Folio builder

    Hi,
    I have list of .folio files and I want to edit those files and copy the text from the .folio fiile.
    Can any tell me how to edit .folio files. 
    Is it possible to edit the .folio files in Folio panel. Or if any other application can able to open the .folio files, please guide me on this.
    Thanks,
    Krish

    You could, but you won't get what you want.
    The .folio file simply contains flattened images/pdfs of the page. So thus, you can't copy the text as though it's XML or part of some sort of word document. I suppose you might be able to try to copy and paste the text off of the PDF, if it's a PDF folio. But.. yick.
    From folio builder, preview the folio on your machine using the desktop Content Ciewer. (Or Export it via Folio Producer after publishing it privately.)
    On your mac, then navigate to \Users\{username}\Library\Application Support\com.adobe.dmp.contentviewer\Local Store\FolioCache\{Folio Name}\{Article Name}\StackResources.
    This should get you to the PDF files for each article.

  • How to edit a file

    Ok I probably realise that I've missed something in the literature on installing arch somewhere along the way, but I've spent the last 3 hours trying to find how get past this stage to no avail.
    I've managed to realise I have a dhcp connection.
    For DHCP IP
    For this option, you need the dhcpcd package (already available on most installations). To make use of it, edit /etc/rc.conf like this:
    eth0="dhcp"
    INTERFACES=(eth0)
    ROUTES=(!gateway)
    but when i type "edit /etc/rc.conf" I get a colon
    I presume I'm in some kind of editor, but I can't see what I'm supposed to change and what commands to use inside the editor.
    Any help gratefully received

    bzzzz Arch is for competent Linux users - not knowing how to edit a file suggests that you do not fall into this category. If you wish to persevere and use Arch as a learning tool, then you need to be aware that you will be required to do most of the work yourself.
    See the wiki: https://wiki.archlinux.org/index.php/FA … se_Arch.3F

  • How to edit xml file particular value. and how to send xml file over ip address 192.168.2.10 using ftp

    how to edit xml file particular value. and how to send xml file over ip address 192.168.2.10 device using ftp through Ethernet

    Hello
    For using FTP function in LabVIEW, I recommend you to check this document: FTP Basics
    Also, take a look at FTP Browser.vi, which is available at the Example Finder.
    To edit a XML file, try to use VIs in XML palette. Maybe Write to XML.vi helps you.
    Post your current VI if possible.
    Regards
    Mondoni

  • Hi, somebody knows how to edit a file that I created in corel draw 11 and I need to edit like PDF!!!! is so simple and nobody knows howwwwwwwwwwww!!!!

    Hi, somebody knows how to edit a file that I created in corel draw 11 and I need to edit like PDF!!!! is so simple and nobody knows howwwwwwwwwwww!!!!

    See your other thread.

  • Editing text file on application server

    Hello,
    I have created a utility in which I can move files from one folder to another. Now we also need a option by which I can edit text file on the server folders. Is there a function module by which I can edit text from application server ?
    Regards,
    Rajesh.

    With OPEN DATASET and READ you can load them into an internal table. Next put them on screen in lets say the text editor (enjoy SAP Controls). This is one way of doing this, other way would be:
    Upload data with OPEN DATASET into internal table, download file to local drive (cl_gui_frontendservices=>gui_download), open it with notepad (for example) edit it and save. Next upload file into your program (cl_gui_frontendservices=>gui_upload) and download it to server again (OPEN DATASET and TRANSFER).
    If available you can also use transaction CG3Z and CG3Y.

  • How to write text file in Shockwave?

    Does anybody know how to write text file in Shockwave to
    user's disk?
    Thanks in advance.

    Those Xtras can wreak to much havoc when used with the wrong
    intent.
    What you can do is write with setpref and store a list of
    saves and the
    saves itself seperatly. Then you'd have to build your own
    save/open
    dialog to let the user:
    * pick a previously saved file to load or overwrite
    * have the user type the name of a new file to save.
    Only thing that remains is that the user cannot decide where
    the files
    are saved.
    Manno
    SiuLinda wrote:
    > Thanks a lot for your reply.
    > Yes, cookies is good but I have to write a program to
    save the text file in
    > where the user wants, user can open these files later if
    they like, like using
    > Filextra and Fileio, but I found all of these xtras seem
    to be not supported in
    > shockwave.
    >
    Manno Bult
    [email protected]

  • How to read text file line by line...?

    how to read text file line by line, but the linefeed is defined by user, return list of string, each line of file is a item of list?
    please help me.
    Thanks very much

    Brynjar wrote:
    In Groovy, you would do something like:
    linefeed = "\n" //or "\r\n" if the user chose so
    lines = new File('pathtofile').text.split("${linefeed}")This is one of the things that has always annoyed me about Sun's sdk, i.e. the lack of easy ways to do things like that. You always end up making your own utilities or use something like Apache's commons.io. Same goes for jdbc and xml - I'll wait for appropriate topics to show how easy that is in Groovy :)I generally agree, but what I really don't like about the Groovy text-file handling niceties: They don't care about encoding/always use the default encoding. And as soon as you want to specify the encoding, it gets a lot more complex (granted, it's still easier than in Java).

  • How to load text file data to Oracle Database table?

    By using Oracle Forms, how to load text file data to Oracle Database table?

    Metalink note 33247.1 explains how to use text_io as suggested by Robin to read the file into a Multi-Row block. However, that article was written for forms 4.5 and uses CREATE_RECORD in a loop. There was another article, 91513.1 describing the more elegant method of 'querying' the file into the block by transactional triggers. Unfortunately this more recent article has disappeared without trace and Oracle deny its existence. I know it existed as I have a printed copy in front of me, and very useful it is too.

  • How to load text files in GUI

    plz tell me .. how to load and compare two text files using file popup's . example file i have attached..
    Attachments:
    testW_FF.txt ‏2 KB

    I don't understand whether your question is on how to load text files or how to show them on a panel or how to compare them... or all aspects together!
    The first operation (loading the file) can be accomplished with functions included in the Formatting and I/O Library like OpenFile, ReadFile and so on; with a file like yours even FileToArray could be an option.
    How to show the data on screen is heavily dependent on what you intend to do with them: data can be shown in textboxes, listboxes, tables or graphs so... what do you want to do?
    The same applies with comparison: without additional details is difficult to give you the proper hint.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Step by Step"How JSP read text file :

    Hi ,
    Any one know or have a good site to show step by step how JSP read text file.
    TQ.

    There is no difference Between reading a text file from JSP and reading a text file from Java.
    Just follow the same steps for JSP also.

  • How to edit NTFS file permissions in Windows PE 3.0

    Does anyone know how to edit NTFS file permissions from Windows PE 3.0?

    Hello,
    The Windows Desktop Perfmon and Diagnostic tools forum is to discuss performance monitor (perfmon), resource monitor (resmon), and task manager, focusing on HOW-TO, Errors/Problems, and usage scenarios.
    Since your post is off-topic, I am moving it to the
    off topic forum.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • How to Edit PSD Files In Flash Template

    Hi Everyone,
    I am new to flash and I am trying to create my first flash site using a template that I have downloaded. I can edit the first page fine, but when I click the "about us" or any other section, the standard template text, Which isn't even in english, appears. I believe that these are psd files, and I have tried to edit them, saved and replaced file on my computer, but still I get the same unchanged text on this site when I preview. Could someone please tell me how to edit and replace these files within the flash movie?

    Instance names are the reference names that you give to the individual items on the stage. Only movieClip and button symbols can have instance names.
    When you import a photoshop file to Flash you will get individual bitmap objects on the stage and in a folder in the movie's Library. You will need to select each item, one at a time, on the stage and convert each one to a symbol. When you make that conversion the name that you give to that new movieClip or button is the name that you will see in the Library.
    When you select that new symbol on the stage, look at the Properties window. You will now see a space at the top where you can give that item an instance name. The instance name is what you will use in Actionscript to control that object on the stage.
    When you look in the movie's Library, you will see the original bitmap and the symbol that you created that contains that bitmap.
    Does that help?

  • How to read text file contain chinese character ?

    Hi XI Expert,
    I have scenario to read text file contain Chinese Character using sender file adapter. but every i was check from sxmb_moni all the chinese character looks different. and also the target file also i has changes.
    Please advise me how to maintaine the chinese character in PI 7.0 SP17.
    Thank You and Best Regards
    Fernand

    Hi,
    Refer these threads..
    Receiver file adapter corrupting characters
    Problem in converting special characters in input text file
    Here is one more useful guide..
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42
    Regards,
    Sarvesh
    Edited by: Sarvesh Singh on Nov 17, 2008 3:47 PM

Maybe you are looking for

  • How to create report writer in sap?

    Hi Anybody,   I want to create new report writer for finance report for ex: (p & L or balance sheet), i don't know how to create report writer in sap. anybody please tell me with example? Thanks Regards, S.Muthu. IT Dept.

  • MacBook wont boot up all the way!!

    I recently updated my computer with Quiktime and itunes applications and it asked me to restart after updates were complete. It restarted but it gets stuck on the gray screen with the apple and the turning wheel and wont go any further. I read simila

  • Pavilion g6

    Pavilion g6 replaced cracked screen and now message states hard drive not found. Hard drive crash? Did screen breaking cause this? Could I have disconnected hard drive while replacing screen? Can the data be recovered?

  • Navigation Buttons

    I downloaded a Flash template and I was able to edit the html files. But I am having difficulty linking the Flash navigation buttons to the other pages. For example, to index-2.html, index-3.html, etc. I went into Actions and typed this in the getURL

  • Div box shifted position when previewed on browsers??

    Hi, Can anyone please advise why one of my div boxes (the third one) in Dreamweaver shifted position when previewed on Firefox and IE?  My other two div boxes have no problem when previewed on browsers. #textBoxForDesignTitle {     height: 40px;