How do i split content from the text file using tab and spaces...?
Hi.. Just want to ask help to all the experts. Im new in java and i have this problem on how to split the contents of the text file. ill show you the contents in order to let you see what i mean.
FileName: COL.txt
AcctNo AcctName Primary Secondary Status Opendate
121244 IPI Company Noel Jose Active 12/05/2007
As you can see the content i want to split it per column.. Please help me
Jose_Noel wrote:
Hi prometheuzz,
What do you mean by one thread...?You created two threads* with the same question in it. That way, people might end up giving you an answer that has already been posted in your other thread: thus wasting that person's time.
Just don't create multiple threads with the same question please.
* a thread is a post here at the forum
Similar Messages
-
How can I print stuff from the 'Help' file using my MacBook Air?
How can I print stuff from the 'Help' file using my MacBook Air?
Open the Help viewer, select a category then from the menu bar top of your screen, click File > Print
-
How to do import data from the text file into the mathscript window?
Could anyone tell me how to do import data from text file into mathscript window for labview 8?
MathScript Window openned, File, Load Data - it has options: custom pattern (*.mlv) or all files.
ThanksHi Milan,
Prior to loading data in Mathscript Window , you have to save the data from the Mathscript window (the default extension of the file is .mlv but you can choose any extension). This means that you cannot load data from a text file that was not created using the Mathscript window.
Please let me know if you have any further questions regarding this issue.
Regards,
Ankita -
How to read some lines from a text file using java.
hi,
i m new to java and i want to read some lines from a text file based on some string occurrence in the file. This file to be read in steps.
we only want to read the file upto the first Occurrence of "TEXT" string.
How to do it ,,,
Kinldy give the code
Regards,
Sagar
this is the text file
dfgjdjj
sfjhjkd
ghjkdg
hjkdgh TEXT
ikeyt
ujt
jk
tyk TEXT
rukl
rHendawy wrote:
Since the word "TEXT" is formed of 4 letters, you would read the text file 4 bytes by four bytes. Wrong on two counts. First, the file may not be encoded 1 byte per character. It could be utf-16 in which case it would be two byte per character. Second, even if it were 1 byte per character, the string "Text" may not start on a 4 byte boundary.
Consider a FileInputStream object "fis" that points to your text file. use fis.read(byte[] array, int offset, int len) to read every four bytes. Convert the "TEXT" String into a byte array "TEXT".getBytes(), and yous the Arrays class to compare the equality of the read bytes with your "TEXT".getBytes()Wrong since it relies on my second point and will fail when fis.read(byte[] array, int offset, int len) does not read 4 bytes (as is no guaranteed to). Check the Javadoc. Also, the file may not be encoded with the default character encoding.
The problem is easily solved by reading a line at a time using a BufferedReader wrapping an InputStreamReader wrapping a FileInputStream and specifying the correct character encoding.
Edited by: sabre150 on Apr 29, 2009 2:13 PM -
How to read specific lines from a text file using external table or any other method?
Hi,
I have a text file with delimited data, I have to pick only odd number rows and load into a table...
Ex:
row1: 1,2,2,3,3,34,4,4,4,5,5,5,,,5 ( have to load only this row)
row2: 8,9,878,78,657,575,7,5,,,7,7
Hope this is enough..
I am using Oracle 11.2.0 version...
ThanksThere are various ways to do this. I would be inclined to use SQL*Loader. That way you can load it from the client or the server and you can use a SQL*Loader sequence to preserve the row order in the text file. I would load the whole row as a varray into a staging table, then use the TABLE and MOD functions to load the individual numbers from only the odd rows. Please see the demonstration below.
SCOTT@orcl12c> HOST TYPE text_file.csv
1,2,2,3,3,34,4,4,4,5,5,5,,,5
8,9,878,78,657,575,7,5,,,7,7
101,201
102,202
SCOTT@orcl12c> HOST TYPE test.ctl
LOAD DATA
INFILE text_file.csv
INTO TABLE staging
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(whole_row VARRAY TERMINATED BY '/n' (x INTEGER EXTERNAL),
rn SEQUENCE)
SCOTT@orcl12c> CREATE TABLE staging
2 (rn NUMBER,
3 whole_row SYS.OdciNumberList)
4 /
Table created.
SCOTT@orcl12c> HOST SQLLDR scott/tiger CONTROL=test.ctl LOG=test.log
SQL*Loader: Release 12.1.0.1.0 - Production on Tue Aug 27 13:48:37 2013
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
Path used: Conventional
Commit point reached - logical record count 4
Table STAGING:
4 Rows successfully loaded.
Check the log file:
test.log
for more information about the load.
SCOTT@orcl12c> CREATE TABLE a_table
2 (rn NUMBER,
3 data NUMBER)
4 /
Table created.
SCOTT@orcl12c> INSERT INTO a_table (rn, data)
2 SELECT s.rn,
3 t.COLUMN_VALUE data
4 FROM staging s,
5 TABLE (s.whole_row) t
6 WHERE MOD (rn, 2) != 0
7 /
17 rows created.
SCOTT@orcl12c> SELECT * FROM a_table
2 /
RN DATA
1 1
1 2
1 2
1 3
1 3
1 34
1 4
1 4
1 4
1 5
1 5
1 5
1
1
1 5
3 101
3 201
17 rows selected. -
I've been having trouble with my clipboard while using my adobe ink. Is there any way I can erase the images saved on the clipboard, because have been trying and I can't find a way to do it, it seems like the only option is by turning the selection into favorites and then a trashcan icon appears, but even if I choose delete it will only be erased from the clipboard favorites while remaining on the clipboard.
I've thought erasing the sketches App, or deleting the project but I don't want to risk losing my work.
Thanks!I posed a similar question in the Draw forum and got this reply:
Re: How to clear the clipboard and empty drawings ?
In short: you can't erase those clippings, at least not currently. -
Search for a word and return all the lines (row) from the text file..
Hi all,
I need a help on how to search a string from the text file and returns all the lines (rows) where the searched string are found. I have included the code, it finds the indexof the string but it does not return the entire line. I would appreciate your any help.
public class SearchWord
public static void main(String[] args){
//Search String
String searchText = "man";
//File to search (in same directory as .class file)
String fileName = "C:\\Workspace\\MyFile.txt";
//StringBuilder allows to create a string by concatinating
//multiple strings efficiently.
StringBuilder sb =
new StringBuilder();
try {
//Create the buffered input stream, which reads
//from a file input stream
BufferedInputStream bIn =
new BufferedInputStream(
new FileInputStream(fileName));
//Holds the position of the last byte we have read
int pos = 0;
//Holds #of available bytes in our stream
//(which is the file)
int avl = bIn.available();
//Read as long as we have something
while ( avl != 0 ) {
//Holds the bytes which we read
byte[] buffer = new byte[avl];
//Read from the file to the buffer
// starting from <pos>, <avl> bytes.
bIn.read(buffer, pos, avl);
//Update the last read byte position
pos += avl;
//Create a new string from byte[] we read
String strTemp =
new String(buffer);
//Append the string to the string builder
sb.append(strTemp);
//Get the next available set of bytes
avl = bIn.available();
catch(IOException ex) {
ex.printStackTrace();
//Get the concatinated string from string builder
String fileText = sb.toString();
int indexVal = fileText.indexOf(searchText);
//Displays the index location in the file for a given text.
// -1 if not found
if (indexVal == -1)
System.out.println("No values found");
else
System.out.println("Search for: " + searchText); }
}Hi, you can use servlet class and use this method to get the whole line of searched string. You can override the HttpServlet to treat that class as servlet.
public class ReportAction extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//write your whole logic.
BufferedReader br = new BufferedReader(new FileReader("your file name"));
String line = "";
while(line = br.readLine() != null) {
if(line.contains("your search string")) {
System.out.println("The whole line, row is :"+line);
} -
How to read a tab seperated data from a text file using utl_file
Hi,
How to read a tab seperated data from a text file using utl_file...
I know if we use UTL_FILE.get_line we can read the whole line...but i need to read the tab separated value separately.....
Thanks in advance...
NaveenNaveen Nishad wrote:
How to read a tab seperated data from a text file using utl_file...
I know if we use UTL_FILE.get_line we can read the whole line...but i need to read the tab separated value separately.....If it's a text file then UTL_FILE will only allow you to read it a line at a time. It is then up to you to split that string up (search for split string on this forum for methods) into it's individual components.
If the text file contains a standard structure on each line, i.e. it is a fixed delimited structure, then you could use external tables to read the data instead. -
How to read some records from a text file into java(not all records)
hello,
how to read text files into java. i need only few records from the text file not all records at a time.
If any one knows plz reply me
my id is [email protected]this snipet reads a text file line by line from line 1 to 3
try {
FileReader fr = new FileReader(directory);
BufferedReader br = new BufferedReader(fr);
int counter = 0;
while ((dbconn = br.readLine()) != null) {
switch(counter){
case 0:
status = dbconn;
break;
case 1:
userName = dbconn;
break;
case 2:
apword = dbconn;
break;
counter++;
br.close();
}catch(IOException e){
} -
How do I purchase apps from the app store using coupons?
How do I purchase apps from the app store using coupons?
Coupons as in iTunes Store Gift Cards? If you go to the iTunes store tab, there should be an option to "Redeem" in the Quick Links section on the right side of the home screen. Enter the code there to redeem the credit, and then download whatever you wish from the store.
-
I have an apple ser 5 iPod Nano version 1.03 PC ser DC*****OGV.
I purchased ICloud how do I activate/connect iPod?
How do I transfer music from the computer onto my laptop and gave 2 pieces of equipment on ICloud?
<Edited by Host>Copy everything from your old computer, or your backup copy of your old computer, to your new one.
-
Uploading into database table from text file using tab (GUI_UPLOAD)
i have small doubt
i have 3 fiels in text file using tab as separator
i need to update into database table 'ZABPSP_01'
from 's.txt' located in local disk.
My code is below.
Please let me know the correction.
Awaiting for ur response.
Thanks in advance
REPORT ZABPSPPRG_02.
TABLES: LFA1,MARA,KNA1,ZABPSP_01.
DATA: begin of itab occurs 0,
IKUNNR type zabpsp_01-kunnr,
IMATNR type zabpsp_01-matnr,
IADRNR type zabpsp_01-adrnr.
DATA:END OF ITAB.
DATA: FILENAME1 TYPE STRING.
FILENAME1 = 'C:/s.txt'.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FILENAME1
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = itab.
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF sy-subrc EQ 0.
zabpsp_01-kunnr = ITAB-IKUNNR.
zabpsp_01-matnr = ITAB-IMATNR.
zabpsp_01-adrnr = ITAB-IADRNR.
WRITE : / ' UPLOAD SUCCESS ' .
ENDIF.
\[subject changed, don't write everything in upper case!\]
Edited by: Jan Stallkamp on Aug 6, 2008 2:39 PMHi,
After upload modify the code like below. Also change the file name as some one suggested already. If u are still facing problems then check in debug mode what is happening after FM call.
CALL GUI_UPLOAD FM.
IF sy-subrc EQ 0
IF NOT itab[] IS INITIAL.
MODIFY ZABPSP_01 FROM TABLE itab.
WRITE : / ' UPLOAD SUCCESS ' .
ELSE.
WRITE 'No data in file'.
ENDIF.
ELSE.
WRITE 'Upload failure'.
ENDIF.
Thanks,
Vinod. -
How to apply special right to the PDF file using the LiveCycle Rights Management Server.?
I want to edit bar code field data using Adobe Reader. Bar Code field was designed and data was changing using Acrobat X1 Professional (Trial Version). But can't do so in adobe reader.I think that product has nothing to do with it. You would use LiveCycle Reader Extensions.
-
I would like to plott data from a text file in the same way as a media player does from a video file. I’m not sure how to create the pointer slide function. The vi could look something like the attached jpg.
Please, can some one help me?
Martin
Attachments:
Plotting from a text file like a media player example.jpg 61 KBHI Martin,
i am not realy sure what you want!?!?
i think you want to display only a part of the values you read from XYZ
so what you can do:
write all the values in an array.
the size of the array is the max. value of the slide bar
now you can select a part of the array (e.g. values from 100 to 200) and display this with a graph
the other option is to use the history function of the graphes
regards
timo -
How to remove link content from the link structure field
Hi,
I created a UDF as Link struture in marketing document title to link external file. After file has been linked to the UDF and saved, how do I remove it to empty the field? I tried to point to the field and right click, but couldn't find any function to remove the link.
KCPress ALT + Double Click to remove the Link content from the UDF
Maybe you are looking for
-
Pages: Is there a way to make lines independent, like a real word processor
There are so many things that infuriate me about Pages. Save As.. missing, autosave, etc which are NOT like 99% of other apps on the Mac. Specifially (today): I have a letter in Pages. It's a standard business letter you have see 1m times. After the
-
Is it possible to change firmware?
Hi, I want to buy a router. Since I'm a happy Apple user, I think Airport Extreme would be a nice option for me. There're some Linux-based router firmwares (Tomato, OpenWRT, FreeWRT,...) that supposedly transform a regular router into a "super router
-
Wlan connection interrupts 1-2 min - Satellite P300D-21K
Hi, I have a satelite laptop. P300D-21K. My wireless connection seems to get interupted every 1-2 mins. I can tell this becasue when I am streaming shows off BBC iplayer, or youtube, you can see that the buffering stops and the audio/video will then
-
How to recover missing index.html files
How to recover required index.html files in Pages?
-
TA24901 Mac OS X 10.4.11 not agreeing with iTunes. HELP!
i have the mac os x 10.4.11 and i want to install itunes but it says i need a new version. this is ridulous. alls i want to do is plug my iPod touch in but it says i need to install a new iTunes. I am so fed up with apple today