How to handle ' " '(double quotes) in .csv file during migration
I am facing problem in migrating data from sql server 2000 into oracle via .csv file using sql loader.
1>How should i migrate the string which contains ' " ' (double quotes) characters,
as i am enclosing the string in ' " ' in .ctl file (enclosed by ' " ').
is there any syntax in the control file which can migrate the ' " '(double quotes) as it is as the data in the files is 50000 records .?
Thank you..
Yes this is correct.
but problem will occur when e.g check the foll. string.
(1001,And I quote "This, will work")
Here it is a comm(,) in b/w "This and will".
due to this sqlldr interpret it as end of field. and throws an error.
I had gone through expert one on one oracle, what it maintioned as,
put an extra double quotes( " ) like " " to enclosed the double quoted string.
This works fine. For small data it can be done manually.
But for large data what condition can be put in the ctl file to achieve this?
or is there any other way to achieve this?
Thank you.
Similar Messages
-
FTP Adapter: double quotes in csv file
Hello,
I have a BPEL (10.1.3.3) process in polling with the FTP Adapter on a CSV (with a ; as separator) file with native format translation. In the following the xsd generated:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
targetNamespace="http://namespace1.com/bpel/LoadRivenditoriAdapter"
xmlns:tns="http://namespace1.com/bpel/LoadRivenditoriAdapter"
elementFormDefault="qualified"
attributeFormDefault="unqualified" nxsd:encoding="Cp1252" nxsd:hasHeader="false" nxsd:stream="chars" nxsd:version="NXSD">
<xsd:element name="Accounts">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Account" minOccurs="1" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="DITTA" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";">
</xsd:element>
<xsd:element name="VIA" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";">
</xsd:element>
<xsd:element name="CAP" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";">
</xsd:element>
<xsd:element name="CITTA" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";">
</xsd:element>
<xsd:element name="PROV" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";">
</xsd:element>
<xsd:element name="REGIONE" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Some fields in the CSV file can have double quotes (") inside the values like:
"value1""";value2;value3";value4
When this happens, the adapter reject the file. How can i solve this issue? There is some option to set inside the XSD?
Thank you in advance.
RiccardoThank you for your help, but I've already tried with the quotedBy atribute and it doesn't work. The double quote character can occur multiple times inside the single value and it's not representing a delimiter: it's a part of the field value. For me it's not important, it could be ignored, but the problem is that I don't know how, since the adapter fails to read the file rejecting it.
Riccardo -
Newline character within double quotes in csv file
I have an external table defined as follows:
CREATE TABLE EXT_MASTER
( "SOME_CODE" VARCHAR2(255 BYTE),
"FAX_NUMBER" VARCHAR2(255 BYTE),
"WEB_ADDRESS" VARCHAR2(255 BYTE),
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY "SOME_DIR"
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE
NODISCARDFILE
LOGFILE 'master.log'
BADFILE 'global.bad'
SKIP 1
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LRTRIM
MISSING FIELD VALUES ARE NULL
LOCATION
( 'Master.csv'
REJECT LIMIT UNLIMITED;In my datafile I have newline characters within double quotes. This seems to be illegal using the above definition for the table.
Is there a way to make Oracle ignore newline characters in csv files when they are enclosed in double quotes? Or should I ask my data provider to remove them?Here is what i got on 10.2.0.3 (don't think it might be different on 9i):
SQL> select * from t;
ID TEAM_ID TEAM_NAME
col1 co col3
l2
col11 col12 col13
col21 col22 col23
SQL> !cat a.txt
"col1","co
l2","col3"
"col11","col12","col13"
"col21","col22","col23"
SQL> select * from t;
ID TEAM_ID TEAM_NAME
col1 co col3
l2
col11 col12 col13
col21 col22 col23The external table definition is:
CREATE TABLE t(
"ID" VARCHAR2(255 BYTE),
"TEAM_ID" VARCHAR2(255 BYTE),
"TEAM_NAME" VARCHAR2(255 BYTE)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY "SOME_DIR"
ACCESS PARAMETERS
( RECORDS DELIMITED BY 0x'220A'
BADFILE 'a.bad'
LOGFILE 'a.log'
FIELDS TERMINATED BY ',' LDRTRIM
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL FIELDS
( "ID" CHAR(255)
TERMINATED BY "," ENCLOSED BY '"',
"TEAM_ID" CHAR(255)
TERMINATED BY "," ENCLOSED BY '"',
"TEAM_NAME" (*+1) CHAR(255)
TERMINATED BY ","
LOCATION
( 'a.txt'
REJECT LIMIT UNLIMITED;Best regards
Maxim -
How to handle comma while importing CSV file in APEX 3.2
I am trying to import excel sheet data into a table. I have followed steps mentioned in below link and they work just fine with one exception.
http://avdeo.com/2008/05/21/uploading-excel-sheet-using-oracle-application-express-apex/
Exception is related to presense of comma (,) in any particular filed like- Address.
How can I handle this situation? I am using APEX 3.2
Thanks,
AbhiWrong forum.
You should be here.
Oracle Application Express (APEX) -
How to handle the quotes('') in the procedure?
Hi all,
I have been struggling with an issue in the procedure. Let us go to the functionality of the preocedure.
I am passing a parameter that has text like
' INDIA,BANGALORE,"INOX,BLR","THILAK NAGAR,JAYA NAGAR "4TH 'T' BLOCK,BANGALORE",560030'
Here, INDIA = country field
BANGALORE = city field
INOX,BLR = Theatre field
THILAK NAGAR,JAYA NAGAR "4TH 'T' BLOCK,BANGALORE = address field
560030 = pin field
I want to load these fields into the table thru procedure. Here the issue is if any field value come with quotes(") inside the quotes like above address field. Since , please guide me how to handle that quotes while identifying the field value for either or address field or some other one.
Table structure:
country varchar2(100 char)
city varchar2(100 char)
theatre varchar2(100 char)
address varchar2(2000 char)
pin NUMBER
Procedure Code:
create or replace
PROCEDURE prc_rollout_upload( p_text VARCHAR2 )
AS
v_quote_ind NUMBER := 0;
v_first_pos NUMBER := 0;
v_end_pos NUMBER := 0;
v_text_data varchar2(32767 CHAR) := p_text;
v_text_data1 varchar2(32767 CHAR);
v_text_arr_ind NUMBER := 0;
v_quote_pos NUMBER := 0;
v_comma_pos NUMBER := 0;
type text_rec IS RECORD(country VARCHAR2(20 CHAR),
CITY VARCHAR2(1000 CHAR),
exhibitor VARCHAR2(1000 CHAR),
address VARCHAR2(10000 CHAR),
PIN varchar2(6)
type v_text_tab is table of text_rec;
v_text_array v_text_tab := v_text_tab();
BEGIN
-- Fetch the values from the string to a PL/SQL table
v_text_data1 := v_text_data;
v_text_arr_ind := v_text_arr_ind + 1;
v_text_array.extend(v_text_arr_ind);
-- Country
IF (INSTR(v_text_data1, CHR(34)) > 0 )
THEN
v_quote_ind := INSTR(v_text_data1, CHR(34));
v_first_pos := INSTR(v_text_data1, CHR(34));
v_end_pos := INSTR(v_text_data1, CHR(34),1,2);
v_text_array(v_text_arr_ind).country := SUBSTR(v_text_data1,v_first_pos+1,v_end_pos-2);
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).country);
v_text_data1 := SUBSTR(v_text_data1,v_end_pos+2);
--DBMS_OUTPUT.PUT_LiNE(v_text_data1);
END IF;
IF ( v_quote_ind = 0 ) THEN
v_text_array(v_text_arr_ind).country := SUBSTR(v_text_data1,1,INSTR(v_text_data1,CHR(44))-1);
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).country);
v_text_data1 := SUBSTR(v_text_data1,INSTR(v_text_data1,CHR(44))+1);
-- DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_first_pos := 0;
v_end_pos := 0;
v_quote_ind := 0;
END IF;
-- City
v_quote_pos := INSTR(v_text_data1,CHR(34));
v_comma_pos := INSTR(v_text_data1,CHR(44));
IF ( v_quote_pos < v_comma_pos )
THEN
v_quote_ind := INSTR(v_text_data1, CHR(34));
v_first_pos := INSTR(v_text_data1, CHR(34));
v_end_pos := INSTR(v_text_data1, CHR(34),1,2);
v_text_array(v_text_arr_ind).city := SUBSTR(v_text_data1,v_first_pos+1,v_end_pos-2);
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).city);
v_text_data1 := SUBSTR(v_text_data1,v_end_pos+2);
--DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_quote_pos := 0;
v_comma_pos := 0;
END IF;
IF ( v_quote_pos > v_comma_pos ) THEN
v_text_array(v_text_arr_ind).city := SUBSTR(v_text_data1,1,INSTR(v_text_data1,CHR(44))-1);
-- DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).city);
v_text_data1 := SUBSTR(v_text_data1,INSTR(v_text_data1,CHR(44))+1);
--DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_first_pos := 0;
v_end_pos := 0;
v_quote_ind := 0;
v_quote_pos := 0;
v_comma_pos := 0;
END IF;
-- Exhibitor
v_quote_pos := INSTR(v_text_data1,CHR(34));
v_comma_pos := INSTR(v_text_data1,CHR(44));
IF ( v_quote_pos < v_comma_pos )
THEN
v_first_pos := INSTR(v_text_data1, CHR(34));
v_end_pos := INSTR(v_text_data1, CHR(34),1,2);
v_text_array(v_text_arr_ind).exhibitor := SUBSTR(v_text_data1,v_first_pos+1,v_end_pos-2);
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).exhibitor);
v_text_data1 := SUBSTR(v_text_data1,v_end_pos+2);
--DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_quote_pos := 0;
v_comma_pos := 0;
END IF;
IF ( v_quote_pos > v_comma_pos ) THEN
v_text_array(v_text_arr_ind).exhibitor := SUBSTR(v_text_data1,1,INSTR(v_text_data1,CHR(44))-1);
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).exhibitor);
v_text_data1 := SUBSTR(v_text_data1,INSTR(v_text_data1,CHR(44))+1);
-- DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_first_pos := 0;
v_end_pos := 0;
v_quote_pos := 0;
v_comma_pos := 0;
END IF;
--Address
v_quote_pos := INSTR(v_text_data1,CHR(34));
v_comma_pos := INSTR(v_text_data1,CHR(44));
IF ( v_quote_pos < v_comma_pos )
THEN
v_first_pos := INSTR(v_text_data1, CHR(34));
v_end_pos := INSTR(v_text_data1, CHR(34),1,2);
v_text_array(v_text_arr_ind).address := SUBSTR(v_text_data1,v_first_pos+1,v_end_pos-2);
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).address);
v_text_data1 := SUBSTR(v_text_data1,v_end_pos+2);
--DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_quote_pos := 0;
v_comma_pos := 0;
END IF;
IF ( v_quote_pos > v_comma_pos ) THEN
v_text_array(v_text_arr_ind).address := SUBSTR(v_text_data1,1,INSTR(v_text_data1,CHR(44))-1);
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).address);
v_text_data1 := SUBSTR(v_text_data1,INSTR(v_text_data1,CHR(44))+1);
-- DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_first_pos :=0;
v_end_pos := 0;
v_quote_pos := 0;
v_comma_pos := 0;
END IF;
--PIN
v_quote_pos := INSTR(v_text_data1,CHR(34));
v_comma_pos := INSTR(v_text_data1,CHR(44));
IF ( v_quote_pos < v_comma_pos )
THEN
v_first_pos := INSTR(v_text_data1, CHR(34));
v_end_pos := INSTR(v_text_data1, CHR(34),1,2);
v_text_array(v_text_arr_ind).pin := SUBSTR(v_text_data1,v_first_pos+1,v_end_pos-2);
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).pin);
v_text_data1 := 0;
--DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_quote_pos := 0;
v_comma_pos := 0;
END IF;
IF ( v_comma_pos IS NULL OR v_quote_pos > v_comma_pos ) THEN
v_text_array(v_text_arr_ind).pin := v_text_data1;
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).pin);
v_text_data1 := 0;
--DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_first_pos := 0;
v_end_pos := 0;
v_quote_pos := 0;
v_comma_pos := 0;
END IF;
EXCEPTION
WHEN others then
DBMS_OUTPUT.PUT_LiNE(SUBSTR(SQLERRM,1,200));
END prc_rollout_upload;
Oracle version :
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
Your help would be highly appreciated !!!
Regards,
Vissu.....To start with Try this:
SQL> ed
Wrote file afiedt.buf
1 declare
2 v_var VARCHAR2(10000) := 'INDIA,BANGALORE,"INOX,BLR","THILAK NAGAR,JAYA NAGAR ';
3 v_delim VARCHAR2(1) := ',';
4 v_enclose VARCHAR2(1) := '"';
5 v_val VARCHAR2(1000) := NULL;
6 begin
7 v_var := v_var||'"4TH T BLOCK,BANGALORE",500365'||',';
8 FOR I IN 1..5 LOOP
9 v_val := CASE WHEN SUBSTR(v_Var,1,1) <> '"' THEN
10 SUBSTR(v_Var,1,INSTR(v_Var,',',1,1)-1)
11 ELSE
12 SUBSTR(v_Var,2,INSTR(v_Var,'",',1,1) - INSTR(v_Var,'"',1,1) - 1)
13 END;
14 v_Var := CASE WHEN SUBSTR(v_Var,1,1) <> '"' THEN
15 SUBSTR(v_Var,INSTR(v_Var,',',1,1) + 1)
16 ELSE
17 SUBSTR(v_Var,INSTR(v_Var,'",',1,1) + 2)
18 END;
19 dbms_output.put_line(v_Val);
20 END LOOP;
21* end;
SQL> /
INDIA
BANGALORE
INOX,BLR
THILAK NAGAR,JAYA NAGAR "4TH T BLOCK,BANGALORE
500365
PL/SQL procedure successfully completed.
SQL> -
Can i export without double quotes in data files?
How can i export without double quotes in data files using dataexport commands in MaxL?
I don't know of any way to do any formatting in a straight export out of Essbase. BSO lets you choose between a columnar vs. free form (really Essbase) format. That lack of formatting includes removing double quotes.
If you're willing to put up with the limitations (and formatting issues) of an MDX extract to a log file, that approach does not put double quotes around member names. The same is true in Report Scripts although I have a vague recollection that you can put in double quotes if you want it -- obviously you do not.
There are limitations to the above two approaches, the biggest being that they they are not as efficient as a true MaxL export. OTOH, you may want only part of a database to get exported out in which case either approach may be more to your needs.
If in fact you do want to do a full export, there are lots of OS-level ways of removing double quotes. Here's a Windows-based approach:
Removing double quotes in a batch program in Windows 2003 - Stack Overflow
What would life be without hacks like the above? Probably not worth living.
Regards,
Cameron Lackpour -
How to replace double quotes with a single quote in a string ?
Hi All:
Can some one tell me how to replace double Quote (") in a string with a single quote (') ? I tried to use REPLACE function, but I couldn;t get it worked.
My example is SELECT REPLACE('STN. "A"', '"', ''') FROM Dual --This one throws an error
Thanks,
Dima.Whether it is maybe not the more comfortable way, I like the quoting capabitlity from 10g :
SQL> SELECT REPLACE('STN. "A"', '"', q'(')') FROM Dual;
REPLACE(
STN. 'A'{code}
Nicoals. -
How to load the data from .csv file to oracle table???
Hi,
I am using oracle 10g , plsql developer. Can anyone help me in how to load the data from .csv file to oracle table. The table is already created with the required columns. The .csv file is having about 10lakh records. Is it possible to load 10lakh records. can any one please tell me how to proceed.
Thanks in advance981145 wrote:
Can you tell more about sql * loader??? how to know that utility is available for me or not??? I am using oracle 10g database and plsql developer???SQL*Loader is part of the Oracle client. If you have a developer installation you should normally have it on your client.
the command is
sqlldrType it and see if you have it installed.
Have a look also at the FAQ link posted by Marwin.
There are plenty of examples also on the web.
Regards.
Al -
How to handle 2 or more .jar files with an applet
Hey out there
I have created an ftpClient application that uses "jakarta ftpClient". It works fine as an JFrame application � But when I converted the Application into an JApplet I get the following Exception:
java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClient
I have bundled the main application into a .jar file (Application,jar). But I don't know how to handle the 2 jakarta .jar files with my JApplet??
I Tried to append the 2 jakarta .jar files to the Application,jar with the following code:
jar cvf Application.jar 1.class 2.class�. commons-net-1.4.1.jar jakarta-oro-2.0.8.jar
But with the same result / Exception (I have signed the Jar file!)
Can anyone help meHi i have a question with your application can you down- or upload more files at the same time? Because i'm having problems with my ftp application.
Here is the link with my problem maybe you can help me. I will be very pleased when you can help me.
http://forum.java.sun.com/thread.jspa?threadID=5162042&tstart=0
Thx
Satanduvel -
How can we a validate a CSV file in SSIS and log the error details in another CSV File by using Sript Task.
Please see:
http://www.bidn.com/blogs/DevinKnight/ssis/76/does-file-exist-check-in-ssis
http://social.msdn.microsoft.com/Forums/en-US/01ce7e4b-5a33-454b-8056-d48341da5eb2/vb-script-to-write-variables-to-text-file -
How to handle double click in a table control?
Hi,
Can any one let me how to handle double click event in a table control in dialog programming?
here i need to navigate to another screen when user double click on the table contols (emp number column).
thanks in advance,
PrasadBabu.to define double click in your table controlwhich is similar to 'PICK' function. Enable F2 in PF-status for this
Table Control Question
Check the above thread which was posted recently on SDN, please award points if found helpful -
How to handle double click event in a text control
Hi,
Will u please send me information on handling double click events inside text control and also about locking and unlocking of DB tables for updation.
Regards,
Praba.Hi Prabhavathi,
Here is how you handle double click events in Textedit control.
1)Create a custom control in screen (say TEXT_CONTROL)
2)In main program,
a) Declarations:
data: obj type ref to cl_gui_custiom_control.
text type ref to cl_gui_textedit.
b) Create the instance of custom container
c) Create the instance of textedit control.
3)Now to handle double click events , create a local class as follows.
class shail_event definition.
public section.
methods:
handle_doubleclick for event dblclick of cl_gui_textedit .
endclass.
class shail_event implementation.
method handle_doubleclick .
here do the coding for handling the double click.
endmethod.
endclass.
4) Create an instance of the handler class(ie.ZSHAIL_EVENT).Let it be named hand.
5) Define varibles for event.
DATA: i_events TYPE cntl_simple_events,
wa_events TYPE cntl_simple_event.
SET HANDLER hand->handle_doubleclick for text.
wa_events-eventid = cl_gui_textedit=>event_double_click.
wa_events-appl_event = 'X'. "This is an application event
APPEND wa_events TO i_events.
6)
CALL METHOD texte->set_registered_events
EXPORTING
events = i_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
These are the basic steps needed for handling events in Textedit control.You can go to SE24 and type CL_GUI_TEXTEDIT to find the associated events of the class.
If you want the program, kindly send your mail-id so that I can mail it to you.
Regards,
Sylendra. -
How to store double quote into a string?
How to store double quote into a string?
What I mean is:
suppose I want to save the following sentence into string s:
What is the syntax?
Thanks a lot!String s = "<a href=\"../jsp/Logout.jsp\">"
check out this page
http://java.sun.com/docs/books/tutorial/index.html
Hope this helps -
How to handle a comma in a field in CSV file during FCC ?
Hi,
I am having a requirement where we have to convert a CSV file into XML using File Content Conversion . The issue is one of the field in the file is having a comma inside. So the XML parser is taking it as a field separator and throwing an error.
The contents of the file are as follows:
"02975859","New Key","9","Failed, rejected by RTI server"
How to handle a comma inside field "Failed, rejected by RTI server".
Any help would be appreciated.
Regards
PraveshHi ,
You have to write an java mapping programm to perdromance this task , in a estandar way i think is not possible , because the fiel adapter have just one option for the delimiter character.
Here's some code that could help you
Supouse a file in this way:
1,rahul,siemens,mumbai
2,consultant,12032005
1,viswanath,sisl,hyderabad
2,systemeng,23052005
package TXTMapping;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.Map;
import com.sap.aii.mapping.api.StreamTransformation;
public class TMapping implements StreamTransformation {
private Map map;
public void setParameter (Map param){
map = param;
public void execute (InputStream in, OutputStream out){
try{
out.write("<?xml version ='1.0' encoding='UTF-8'?>".getBytes());
out.write("<ns0:Output_Data xmlns:ns0=\"urn:javamapping_test\">".getBytes());
String line = null;
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
StringBuffer buffer = new StringBuffer();
while((line = bin.readLine())!= null){
String Company = null;
String Name = null;
String Place = null;
String Desgn = null;
String Since = null;
char[] str= new char[100];
str = line.toCharArray();
String[] Data = new String[10];
int S1 = 0;
int s2 = 2;
for (int i=2; i<line.length(); i++)
if (str<i>==',' && str[0]=='1')
Data[S1]= line.substring(s2,i);
S1=S1+1;
s2 = i+1;
if (i == line.length()-1 && str[0] == '1')
Data[S1]= line.substring(s2,i+1);
Name = Data[0];
Company = Data[1];
Place = Data[2];
out.write ("<Data>".getBytes());
out.write ("<Header>".getBytes());
out.write (("<Name>"Name"</Name>").getBytes());
out.write (("<Company>"Company"</Company>").getBytes());
out.write (("<Place>"Place"</Place>").getBytes());
out.write ("</Header>".getBytes());
if (str<i>==',' && str[0]=='2')
Data[S1]= line.substring(s2,i);
S1=S1+1;
s2 = i+1;
if (i == line.length()-1 && str[0] == '2')
Data[S1]= line.substring(s2,i+1);
Desgn = Data[0];
Since = Data[1];
out.write ("<Item>".getBytes());
out.write (("<Designation>"Desgn"</Designation>").getBytes());
out.write (("<Since>"Since"</Since>").getBytes());
out.write ("</Item>".getBytes());
out.write ("</Data>".getBytes());
out.write("</ns0:Output_Data>".getBytes());
catch(Throwable t){
t.printStackTrace(); -
How to export data to multiple csv files?
Hey Scripting Guys,
As stated by the name I'm a novice at scripting. Typically I'm able to resolve most of my scripting challenges by reading through your site or scouring the internet. This challenge I haven't been able to resolve. Please help!!
I'm running a script (posted below) to grab data and export it to a csv file. My challenge is that I want to run the script daily via task manager and have it create a new csv file either daily or weekly. I'm having trouble with the scripting
creating a new csv file. How do I resolve this?
It would be beneficial to append the date to a standard file name, ex. c:\exportedcsv7-11-2014.csv; the next day it would be c:\exportedcsv7-12-2014.csv; and so on.
Thank you in advance to any assistance.
Respectfully,
ScriptingNovice
Get-Datastore -Name "*DS*" | Sort $_.name | Get-View | Select -ExpandProperty Summary | `
Select Name,
@{N=”FreeSpaceGB”;E={[Math]::Round($_.FreeSpace/1GB,2)}},
@{N=”CapacityGB”; E={[Math]::Round($_.Capacity/1GB,2)}},
@{N=”UncommittedGB”; E={[Math]::Round($_.Uncommitted/1GB,2)}},
@{N=”ProvisionedGB”;E={[Math]::Round(($_.Capacity – $_.FreeSpace + $_.Uncommitted)/1GB,2)}},
@{N=”Over-Provisioned-DS”;E={([Math]::Round($_.Capacity/1GB,2)) – ([Math]::Round(($_.Capacity – $_.FreeSpace + $_.Uncommitted)/1GB,2))}}| `
select Name,CapacityGB,FreespaceGB,ProvisionedGB,UncommittedGB,Over-Provisioned-DS | export-csv -notype c:\vmds.csvThank you for the information and the tip. I took your advice and did some research on Strings, something that I do have trouble grasping. I'm familiar with variables already and feel comfortable using them. I also need to study .Net which
I totally don't understand.
Since I appreciate your advice and guidance I'd like to know if I'm on the correct track. Please look at my breakdown to see if I'm explaining it correctly.
$d=Get-Date
Here a variable is being created using the Get-Date cmdlet, if we execute $d the date will appear
$d.ToString('dd-MM-yyyy')
This converts the date into the format dd-MM-yyyy.
I took the information and tips you provided then came up with this after reading about strings.
export-csv -notype "c:\folder\vmds_$($d.ToString('MM-dd-yyyy')).csv"
The double quotes evaluate the variables. The single quotes do not evaluate anything they just show what's inside of them (a.k.a. literal string). The $() evaluate the expression in ('MM-dd-yyyy') before writing it.
You are correct I definitely need to strengthen the foundation of my basics. Thank you for the direction and advice.
Maybe you are looking for
-
FI Calendar-Invoice due date on holiday
Dear Gurus, Can any body tell me whether there is any relation between calendar maintained in SAP and due date calculation.User say that due date falling on holiday I am not sure in FI whether holidays are considered for due date calculation.If there
-
Why is iCloud is not listed in my System Preferences?
Apple instructions for setting up iCloud direct me to access it in my Systems Preferences under Internet and Wireless, but it isn't listed there.
-
Getting Msg: Error when calling Credit Management: Technical Error
Hi All, While creation of sales order in ECC, i am getting a message "Error when calling Credit Management: Technical Error" Can you help me in this case Regards, Satish
-
ACR Cache - Is It Broken?
There's been some discussion in another thread about this, but its really off-topic there, and I think warrants its own thread... I can find no value in the ACR cache whatsoever. Begging the questions: - Is it working as it should, and there is some
-
Re-connecting contacts after upgrading to Messages
In the imessage days I made otherwise pointless AIM accounts for relatives so I could screenshare with them for tech support. I have now upgraded one of them to Yosemite and I can't seem to connect to them with my messages app. I was hoping to get aw