Modifying a csv or text file
Guys, does any of you know how to modify a csv or text file? Let's say I got a file containing the following line:
"TV", "85 - <b>Black and White</b>", "Boston"
Now let's say I wanna change the above line to the line below:
Amout: 85 || Color: Black and White || Store Location: Boston
Does anyone know how this can be done? I would really appreciate. Thanks a bunch.
You can't modify a file unless the new data is the same size (number of characters, in your case) as the old data.
Read the existing file and write a new file. Copy the old data, except substitute the new data for the old. Then rename the old file to something, rename the new file to the old name, and then delete the old renamed file.
Similar Messages
-
<p>Also what are the limitations in terms of data size or performance related issues while using csv or text file?</p><p>Is it the best practice to use csv , text file to use as a datasource to improve performance?</p><p>Please Advice.... </p><p> </p>
<p>Hi,</p><p>Create Same Data Input for CSV and Text File ,Create 2 different reports one for CSV and One for Text ,run them one you have done that.</p><p>Go to Report Menu and Select Performance Information .Use the Data in that to check which one is good datasource to improve performance</p><p>Cheers</p><p>Rahul</p>
-
Modifying a read from text file
I understand that in order to read from a text file and display the resulting array in a control, you need to use the property nodes. I've set up the VI to do exactly that.
Now, however, I want to be able to modify the resulting control so that the indicator changes as well. As far as I can tell, the attached VI does this with some small complications. Because of the way the case structure is set up, the timing of the change to the control must be exactly right so that the value will be caught on the right side of the loop (I've put the VI in "Run Continuously" mode).
Is there a better way I can accomplish a similar task and will transition the changes easier?
I've attached the VI as well as a sample text file filled with arbitrary numbers.
Solved!
Go to Solution.
Attachments:
Test.vi 11 KB
test.txt 1 KBWho says you have to use a property node? Use a local variable. It is a lot more efficient and does the same job.
Now for your indicator...USE DATA FLOW. Wire directly to your indicator from where you are updating your control.
Other edits: Only write to the control inside of the case structure. This will make things simpler.
The False case is empty.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Attachments:
Test_BD.png 17 KB -
How to export app list in iTunes to csv or text file?
How to export an app list in iTunes libtary to csv,text, or Excel compatable file format?
Hi Peter,
I found out what caused the Script not running on CS3. In my workstation, there are multiple versions of ExtendScript Toolkit (cs, 2 and CS4). When I am working on the Script it default to the latest version which is ExtendScript Toolkit CS4, so it will refer to CS4, activate and launch CS4.
After pulling my hair finding the cause. I finally search and found ExtendScript Toolkit 2 which work for CS3. I shut down ExtendScript Toolkit CS4 and test the same exact Script . It works perfectly. So if you try to run this Script on CS3. Make sure at the prompt message to see if it will run on Adobe InDesign CS3, then it will run fine. In reverse, if you run the Script on CS4, make sure to check your ExtendScript Toolkit CS4 otherwise it will do nothing like I experienced. Great!
Below is my final code for the Script. This Script will capture all link elements' name as text file so I can search batch of elements from the central server for all pick up logos, images, artworks... to prep for my page assembly workflow. Hope this will help anyone have the same interest. All credit to Peter. Thank for all your help and support.
#target indesign;
try
link_name = app.documents[0].links.everyItem().name;
var f = app.documents.add ().textFrames.add ();
f.geometricBounds = [0.5,0.5,"266mm","203mm"];
f.contents = link_name.sort (caseless).join ("\r");
catch (_){}
function caseless (a, b)
return a.toLowerCase() > b.toLowerCase()
Kenn Nguyen -
Modifying the contents of text file ini j2me
Hi,
I'm developing a application in j2me wherein i need to erase the previous stored contents fromthe text file and store new content submitted thru the front end program. Kindly please suggest me how to proceed in this regard.
ThanksIf you want to change an ini file in the jar file: you can't do that.
You can however store the changes in the RMS. -
How to upload the web query result to CSV/Text file
Hi,
Kindly help me on the following.
1) I have info-provider (IP), which has info-objects "company code" and "supplier".
2) I built a query by putting company-code with a variable in free-charateristics and supplier-code in row.
3) When I run this query, it will ask company-code as input and the result will be filtered using company-code.
4) For this query, I created a web-template and assigned data-provider to display the data on the web.
5) The user wants to enter input company-code='1000' and write the data in a CSV file in a specific directory. i.e, by clicking the execute button (after entering company code) , the result should go to the CSV or text file. i.e. the application should automatically generate the file with query results.
Note: The user should not use context menu to EXPORT TO CSV OR EXCEL file.
Please let me know, if there is any tutorial. Thanks a lot advance help.
Regards
Kandasamy1. SELECT INTO
Below method will create table when data is inserted from one table to another table. Its useful when you need exactly same datatype as source table.
Use AdventureWorks2008R2;
Go
---Insert data using SELECT INTO
SELECT AddressLine1, City
INTO BothellAddresses
FROM Person.Address
where City = 'Bothell';
GO
---VERIFY DATA
Select AddressLine1, City
FROM BothellAddresses
---DROP TABLE
DROP TABLE BothellAddresses
GO
2. INSERT INTO SELECT
Below method will need table to be created prior to inserting data. Its really useful when table is already created and you want insert data from
another table.
Use AdventureWorks2008R2;
Go
---Create Table
CREATE TABLE BothellAddresses (AddressLine1 NVARCHAR(60), City NVARCHAR(30))
---Insert into above table using SELECT
INSERT INTO BothellAddresses(AddressLine1, City)
SELECT AddressLine1, City
FROM Person.Address
where City = 'Bothell';
---VERIFY DATA
Select AddressLine1, City
FROM BothellAddresses
---DROP TABLE
DROP TABLE BothellAddresses
GO
Regards,
Vishal Patel
Blog: http://vspatel.co.uk
Site: http://lehrity.com -
Text Files: Update, Delete, Modify...
Hello all,
I know that java.util.Properties class exists to read and write textual information to files. Is there any other tool available to edit and modify information in a text file? Here's the format I am looking for my text file.
Name=Sri;Occupation=Programmer;FavoriteColor=Green;
Name=Larry;Occupation=Manager;FavoriteColor=Red;
Name=Bill;Occupation=Manager;FavoriteColor=Yellow;
As you can see, there are three records in this text file. I would like to modify one particular value in the record. It seems that I have to rewrite the entire file to do this. Any other solutions?
Thank you,
-Sri :)Seems to me you have to go through each line. My guess is that you have to modify the particular column based on the value of the other columns? So you have to read them in anyway, then you may use the simple replace( ) method in String to change that value you want to modify.
PC -
Emails from a particular sender I would like to get appended to a single or to multiple csv or text files.
I think I've read that Mozilla can use filters to get all emails from a particular sender put in a particular folder.
That might be useful but does not get me all the way to goal.
I've also read about 3rd party plugins that give you export options through additional menu options
However, I need something that just automatically exports (without me having to be there and does not require any mouse commands) whenever an email from a particular sender shows up. And that exports to a csv or txt file.
thanks for any time you spend on this question.
Chrisok I answered my own question on this one.
According to Filtaquilla online documentation:
''(Beginning in Filtaquilla version 1.3.0): By default, the message is saved with the default Thunderbird extension .eml The filter will use a different extension if you append to the file spec a | followed by the extension. So for example if the filespec is C:\temp\saveas\ for the default extension type, change this to C:\temp\saveas\|txt and the extension will be “txt”.''
I was able to verify this works in my test. -
Take an existing text file and modify values
I’m looking to take an existing text file and modify certain values inside of it. Then save it to a new file, with all the same formatting as the original. The file format is not uniform and can change.
Basically the file is:
Random numbers and letters of unknown length for an unknown number of lines.
Label="Test_#"
Description
String
X=123
Y=456
Z=-789
20 lines of strings with numbers in them
Label="Test_#2"
Description
String
X=-1232
Y=4562
Z=7892
Then it repeats a set number of times.
I want to modify the X Y and Z = values for each Test_#.
I’ve managed to import the important values into a numeric array and I have a different array with values that will replace the existing ones. I’m having troubles replacing the existing ones. There are no zeros before or after the existing numbers so they are all different lengths.
If anyone has any sample code that does anything similar please post it. I’m sure someone has done something like this in the past.
Solved!
Go to Solution.I just thought I would throw this out there. Can you make the .txt file tokenized? This would make searching for specific parameters much easier.
Reese, (former CLAD, future CLD)
Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home -
Double quotes missing in CSV file but exist in text file from AL11
Hi I am sending a file to AL11 with one of the fields having double quotes Like "field value" . When i download into Text file i am seeing the quotes but not when download as CSV file from Al11. Any SAP notes for this . If i add multiple quotes ' """" ' to have in csv I am seeing more quotes in text file which is not accepted . Please reply if anyone worked on this before . Thanks Kamesh
The CSV file also has the quotes (check in notepad), but when opened in MS Excel, Excel has a feature to ignore double quotes and consider the comma inside the quotes as part of field, not as a field separator.
-
I have created a text file in Excel, to be saved as a .csv file and uploaded to an online database. The file is rejected. When I open it in textedit I can see that the empty cells ( of which there are several in each row, all in the same columns) contain commas. It looked to me as though this could be the result of tabbing across empty cells. So I created a dummy file with a couple of lines where I tabbed across the whole row including the empty cells, and a couple of lines where I clicked in each individual cell in which I wanted to enter text. Opened in textedit there is no difference between the two type of entry. What can I do to stop Excel or .csv format entering commas in blank cells? Suggestions in simple English appreciated.
http://answers.microsoft.com/en-us/mac/forum/macexcel?tab=QnA
-
Writing or modifying text files in java
Dear all,
I have the next text file:
goods: 5
bids: 4
% num, price, good, good, ..., good, #
0 2075 1 4 #
1 3000 1 2 3 4 #
2 520 3 #
3 3000 2 3 4 #
I have to modify or create the file above, using output data from one java program. For example, The output of my java program in the next execution is:
goods: 8
and price (0) changes from 2075 to 2078.
so, using this output data my java program should write (create or modify) the next text file with the changes:
goods: 8
bids: 4
% num, price, good, good, ..., good, #
0 2078 1 4 #
1 3000 1 2 3 4 #
2 520 3 #
3 3000 2 3 4 #
I have tried using: output.write( objetc );
but it doesn't work as I need :( .
Somebody can help me or give me some idea?
Thanks,
AndreaThis is the code:
File testFile = new File("D:\\result1.txt");
setContents(testFile, " bla bla bla (few characters) ");
static public void setContents(File aFile, String aContents)
throws FileNotFoundException, IOException {
try {
//use buffering
output = new BufferedWriter( new FileWriter(aFile) );
output.write( aContents );
finally {
//flush and close both "output" and its underlying FileWriter
if (output != null) output.close();
I mean, this code dont work because it let me write few characters only. I need to write the whole file:
goods: 8
bids: 4
% num, price, good, good, ..., good, #
0 2078 1 4 #
1 3000 1 2 3 4 #
2 520 3 #
3 3000 2 3 4 #
with the special characters as (#).
Sorry, if it post is not clear.
Thanks. -
How to convert CSV/Text files to XML format
Hi,
I am trying to convert a .csv/.txt(Flat) file(s) to XML format. How can i achive this?
Ex: I want to convert this text file to XML.
Book# first name last name ID# ID1# F#
B99 FRISBY NASIER LUCJ A A 3127 1
B131 HAWKINS MICHAEL LUCJ A A 3129 2
B313 KING JOSHUA CUCJ I I-DORM 10
B307 GRAVES KIMBERLY NUCJ F F-DORM 24-FL
R469 HEATH DARRELL SUCJ A A 3132 1
R212 PEREZ DARRELL SUCJ A A 3133 2
R62 COFFEY GREGORY NUCJ HC H C 3112 3FLOOR
R215 BLACKWELL DEREK LUCJ OOW W 01 1 Could anyone please suggest me if we have any open source java api to acheive this?
Thanks,
Srikanth.Have a look at [http://servingxml.sourceforge.net/|http://servingxml.sourceforge.net/] or [http://www.talend.com/|http://www.talend.com/]
-
Modify text file by different user?
My AIR Application create one text file under Administrator. but guest user cannot modify that text file.The code is below
var file:File = new File("file:///D:/BALA /test.txt ");
var str = String(Math.round(Math.random()*9)+1);
var fileStream:FileStream = new FileStream();
fileStream.openAsync(file, FileMode.WRITE);
fileStream.writeUTFBytes(str);
fileStream.close();
Can any one solve this issue?
Thanks
Regards
Balasubramaniyan.SThe AIR app has the OS rights of the user account used to run the app.
-
CSV , text file out put from flash exe
Hi,
I want to save data from flash exe to CSV file and text file
. OS is XP and there will be no server connections. Is this
possible. Please help.
Thanks,
ManuIf th ecomputer you're working with has some server software
running (Apache or IIS) you could save your data with php or asp.
If you don't then you could use the Shared Objects (which works as
a cookie, so you'll be e bit limited here). There was a function
called MMSAVE back in FlashMX, don't know it that still works, that
writes to a text file (but only in the development enviroment).
Let me know a few more details and we'll find a way.
Cheers
Gorka
Maybe you are looking for
-
Flash 9 doesn't work and has no tech support
I am at my wits end with the macromedia Flash 9 player. I have been trying to fix the problem for weeks and have been negecting my children to fix Flash 9's mistake and there is no phone support for the Flash 9 only internet tech support. I keep emai
-
HT1660 How do I change the order of the songs in a playlist?
How do I change the order of the songs on a playlist. The songs seem to have rearranged themselves.
-
[SOLVED] KDE 4.6 can't create user-places.xbel file
Lately I have been having an issue when I log in to KDE 4.6 for the first time on a user account. A window pops up with the following error: "Unable to save bookmarks in /home/troy/.local/share//user-places.xbel. Reported error was: Insufficient per
-
Abnormality while creating Context Menu
Hi All, When i was working with context menus it is found that the context menus having label like "Copy" "Delete" are not been created.. Any Idea.. Thanks And Regards Abdul Jaleel C
-
Music Skips Some Songs After Choosing "Convert higher bit rate songs to 128 kbps" Option
I have so much music and choosing "convert to 128 Kbps" option makes it from 18 Gb to around 6 gbs but sometimes a few songs are ther