How to append two CSV files using ftp
Hi
Please let me know the FTP command to append the two .CSV files into one .CSV file.
e.g.
Let me explain:
one CSV file has the fields F1 , F2, F3 , F4 and has 5 records
another CSV file has the same sequence of fields F1, F2, F3, F4 and has 10 records
after appending both the files , I must get 15 records.
Thanks
Alok
Ok I will try out.
I am illustrating my requirement as follow
File#1 (type .CSV)
F1 F2 F3 F4
100 566 89 86
235 256 56 12
File#2 (type .CSV)
F1 F2 F3 F4
56 56 98 102
12 23 36 523
23 56 56 89
Now we want to Append File#1 to File#2 as follow:
F1 F2 F3 F4
100 566 89 86
235 256 56 12
56 56 98 102
12 23 36 523
23 56 56 89
Please suggest now that which command would be appropiate.
Alok
Similar Messages
-
How to upload a .CSV file using GUI_UPLOAD
Hi Experts,
In my report, I need to upload .CSV file using GUI_upload..So how to do ....Plz provide solution...Hi prashanthishetty,
this is already answered many times in this forum!
use forum search or wiki search
[http://wiki.sdn.sap.com/wiki/display/Snippets/uploadcsvfilesintointernal+table]
regards
rea -
How to Create a Flat File using FTP/File Adapter
Can any body done workaround on creating the Flat file using FTP/File Adapter?.
I need to create a simple FlatFile either using of delimiter/Fixed length. using the above said adapters we can create XML file, i tried concatinating all the values into a single String and writing into a file, but it does not have proper structure
Can any body help me out on this..
Thanks
RamYou can create a text schema while creating a File Adapter. If schema is specified for File Adapter, it takes care of converting XML into fixed length or delimited format.
Thanks,
-Ng. -
How to read two text files using the Read from spreadsheet.vi and then plot it
I need to read two text files using the read from spreadsheet function and then plot these files over time.
The file with the .res extention is the RMS values (dt and df) and the second file contains the amplitude of a frequency spectrum.
I really appreciate any help..thanks
Attachments:
RMS.txt 1 KB
FREQUENCY.txt 1 KBFrom NI Example Finder:
Write to Text File.vi
Read from Text File.vi
Jean-Marc
LV2009 and LV2013
Free PDF Report with iTextSharp -
How to read a .CSV file using UTL_FILE
HI,
How do i read a .csv file line by line using UTL_FILE?
Thanks in advance
Regards,
Gayatri----do open the file logic
begin
----Let's say this file is delimited by ','
---declare variables
v_startPos number; -- starting position of field
v_Pos number; -- position of string
v_lenString number; -- length
v_first_field varchar2(30);
v_second_field varchar2(30);
v_third_field varchar2(30);
v_fourth_field varchar2(30);
input_String varchar2(1000); -- buffer for each line of file
----Say you have a 4 column file delimited by ','
delimitChar varchar2(1) := ','
Joe;Joan;People;Animal
Teddy;Bear;Beans;Toys
begin
loop
utl_file.get_line(input_file, input_String); -- get each line
---- this will get the first field as specified by the last number
v_Pos := instr(input_String,delChar,1,1);
v_lenString := v_Pos - 1;
v_first_field := substr(input_String,1,v_lenString);
v_startPos := v_Pos + 1;
-- this will get the second field
v_Pos := instr(inString,delChar,1,2);
v_lenString := v_Pos - v_startPos;
v_second_field := substr(input_String,v_startPos,v_lenString);
v_startPos := v_Pos + 1;
-- 3rd field
v_Pos := instr(inString,delChar,1,3);
v_lenString := v_Pos - v_startPos;
v_third_field := substr(input_String,v_startPos,v_lenString);
v_startPos := v_Pos + 1;
-- last field -- there is no delimiter for last field
v_Pos := length(input_String) + 1;
v_lenString := v_Pos - v_startPos;
v_fourth_field := substr(input_String,v_StartPos,v_lenString);
end;
EXCEPTION
WHEN no_data_found then
fnd_file.put_line(FND_FILE.LOG, 'Last line so exit');
exit;
end loop; -
How to upload and download files using FTP to a server(webserver) in JSP
I have to upload and download multiple files Of(size >5 MB)using FTP to a
Server(webserver) in JSP
how to do that ?Or he could create his own tag libraries, no? :)One supposes that, technically, one could create a taglib wrapper around an existing FTP library. There might be licensing issues with distributing that taglib wrapper.
Of course, one could find the FTP RFC online, read it, and implement one's own FTP client implementation, complete with a tag library access point. -
How to Read a CSV file using pure PL/SQL
Hi friends - Is there a possibility to read a .TXT/CSV file from a local machine and display the contents on the form fields each record at one time.
The logic to flow through the records can be build, but the problem is where to begin from to start reading the file using PL/SQL. I don't want to use any third party component/API as such. Is there any way in forms by using PL/SQL to read an external CSV file and interpret the contents.
I have read about SQL * Loader on some sites but cannot find any way to invoke it on windows platform. There seems to be UNIX commands to invoke the .CTL file that is used by SQL Loader. Any help is much apreciated.
RgdsHi Thanks for your replies, TEXT_IO seems to be a solution but not very comprehensive as it provides limited exposed functions to perform complex operations while read and write of files.
I think SQL*Loader is a valid solution, but as I stated in my original quote Im not able to invoke it from the command prompt. The command that is shown on the suggested URL(http://www.orafaq.com/faqloadr.htm) is not found on my machine. I have Windows 2K installed. Is there a seperate patch or a download available from where I can get that .EXE to invoke the utility.
Thanks.. -
How to Downlaod a Excel file using FTP- -JSP
Hi..i am dynamically generating excel file(i.e...writing into the excel file from Acees databse after executing the queries on it)...i have set the content-type to vnd-msexcel ....now i want that file to be downlaoded using FTP...FTP is new to me...any help could be greatly appreciated...
Thanks in advance....JavaWorld published an article about this topic. It is called "Java FTP client libraries reviewed" and it can be found here :
http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp.html
Best regards
Jean-Pierre Norguet
Jean-Pierre Norguet
JavaWorld Press
http://wasa.ulb.ac.be/jp.html -
Compare two pdf files using adobe acrobat through command line
Does anyone know how to compare two pdf files using adobe acrobat through command line. I want to do this via command line because we want to compare hundreds of file every day through some automated windows tasks.
If command line option is not available in acrobat, then is it feasible to make use of acrobat javascript API to do this task?
Any kind of help will be greatly.Command-line: Not possible.
JavaScript: Possible, but very limited. Basically the only thing you can do is simulate clicking the Compare Documents button. The rest has to be done manually.
However, it *might* be possible to automate this process a bit more using a plugin. Ask over at the Acrobat SDK forum for more information... -
How to import an .csv file into the database?
and can we code the program in JSP to import the.csv file into the database.
It is better to use Java class to read the CSV file and store the contents in the database.
You can use JSP to upload the CSV file to the server if you want, but don't use it to perform database operations.
JSPs are good for displaying information on the front-end, and for displaying HTML forms, there are other technologies more suitable for the middle layer, back end and the database layer.
So break you application into
1) Front end - JSPs to display input html forms and to display data retrieved from the database.
2) Middle layer - Servlets and JavaBeans to interact with JSPs. The code that reads the CSV file to parse it's contents should be a Java Class in the middle layer. It makes use of Java File I/O
3) Database layer - Connects to the database using JDBC (Java Database Connectivity), and then writes to the database with SQL insert statements.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Keeping the above concepts in mind, first build a simple JSP and get it to work,
then research on Google , for Java File I/O , discover how to read a file,
Then search on how to readh a CSV file using Java.
After researching you should be able to read the CSV file line by line and store each line inside a Collection.
Then research on Google, on how to write to the database using JDBC
Write a simple program that inserts something to a dummy table in the database.
Then, read the data stored in the Collection, and write insert statements for each records in the collection. -
Hi Guys
I have two csv files with the following headers and I need to import both files into the script to check whether the StaffCode is present in the Creation/Renewal of Contract csv in a DisableAccount Script so I can stop any action to disable the account as
the staff has renewed the contract with the company so the account should not be disabled.
However my accounts are still being disabled. I am not sure now to construct the query so that it detects that the account is to be left alone if the staffcode is present in both files
I does recognize that the $staffcodeN in the renewal file matches the $staffcode in the termination file
but still proceeds to disable or set an expiry date to the account anyway based on the termination file.
How do I stop it from doing that?
1)In the Creation/Renewal of contract file the following headers are present
- TranCode,StaffCode,LastName,FirstName,SocialSecurityNo,DateJoin,Grade,Dept,LastUpdateDate,EffectiveDate
2)In the Disable of contract file the following headers are present
- TranCode,StaffCode,LastName,FirstName,SocialSecurityno,LastDateWorked,Grade,Dept,LastUpdateDate,
My data is not very clean , I have a-lot of special characters such as = , ' ,/ and \ characters to remove first before i can compare the data
Thanks for the help in advance.
Yours Sincrely
Vicki
The following is a short snippet of the code
$opencsv = import-csv "D:\scripts\Termination.csv"
$opencsv2 = import-csv "D:\scripts\RenewContractandNewStaff.csv"
foreach ($usertoaction in $opencsv)
$Trancode = $usertoactionTranCode
$StaffCode = $usertoaction.StaffCode.replace("=","").replace('"','')
$LastName = [string]$usertoaction.LastName.Replace("/","\/").Replace(",","\,")
$FirstName = [string]$usertoaction.FirstName.Replace("/","\/").Replace(",","\,")
$socialsecurityno = $usertoaction.SocialSecurityNo.replace("=","").replace('"','')
$DateJoin = $usertoaction.DateJoin.replace("=","").replace('"','')
$LastDateWorked = $usertoaction.LastDateWorked.replace("=","").replace('"','')
$Grade = [string]$usertoaction.Grade
$Dept = [string]$usertoaction.Dept
$LastUpdateDate = $usertoaction.LastUpdateDate.replace("=","").replace('"','')
$AccountExpiry = [datetime]::Now.ToString($LastDateWorked)
foreach ($usertoaction2 in $opencsv2)
$TrancodeN = $usertoaction2.TranCode
$StaffCodeN = $usertoaction2.StaffCode.replace("=","").replace('"','')
$socialsecurityNoN= $usertoaction2.SocialSecurityNo.replace("=","").replace('"','')
$DateJoinN = $usertoaction2.DateJoin.replace("=","").replace('"','')
$GradeN = [string]$usertoaction2.Grade
$DeptN = $usertoaction2.Dept
$LastUpdateDate = $usertoaction.LastUpdateDate.replace("=","").replace('"','')
$EffectiveDate = $usertoaction.EffectiveDate.replace("=","").replace('"','')
$LastName2 = [string]$usertoaction2.LastName.Replace(",", "").Replace("/","").trim()
$FirstName2 = [string]$usertoaction2.FirstName.Replace("/","").trim()
# Use DirectorySearcher to find the DN of the user from the sAMAccountName.
$Domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$Root = $Domain.GetDirectoryEntry()
$Searcher = [System.DirectoryServices.DirectorySearcher]$Root
$Searcher.Filter = "(sAMAccountName=$samaccountname)"
$doesuserexist1 = $Searcher.Findall()
if ($doesuserexist1 -eq $Null)
{Write-Host $samaccountname "account does not exist"}
elseif ($StaffCodeN -match $staffcode)
write-host "user has renewed the contract, no action taken"
else
if(($lastupdatedate -ne $null)-or($LastDateWorked -ne $null))
write-host "Setting Account Expiry to"$accountexpirydate
#$ChangeUser.AccountExpires = $accountexpirydate
#$Changeuser.setinfo()
if ($UserMailforwarding -ne $null)
#Set Account expiry date to Last Date Worked
# $ChangeUser.AccountExpires = $accountexpirydate
# $Changeuser.setinfo()
write-host "staff" $displayname "with staff employee no" $samaccountname "has
mailforwarding"
Write-host "Please disable the account manually via Active Directory Users & Computers and
Elseif ($accountexpirydate -lt $todaysdate)
#disable the accountHi Vicki,
This Forum has an insert-codeblock function. Using it will make your script far more readable
Your script is missing some parts, it is impossible to follow the problem.
You are performing the same string cleaning action on $opencsv2 for each element in $opencsv, when doing it once should suffice. Why not start it all by cleaning the values and storing the cleaned values in new arrays?
The Compare-Object function is great, why not take it out for a stroll on these lists, it might just safe you lots of unnecessarily complicated code ...
You are creating a new $Domain, $Root and $Searcher object each iteration, when doing it once should suffice. Probably not much of a time-saver, but every little thing contributes.
Try pinpointing the problem by doing extensive logging, not only by writing which action was taken, but writing the inidividual information (variables, mostly) before evaluation occurs. Your if/elseif/else looks sound, so if it's still not doing what you
want, the ingoing data must be different from what you think should be there.
Cheers,
Fred
There's no place like 127.0.0.1 -
How to merge two columns in csv file using vbscript?
How i can merge two column in csv file using vbscript or powershell?
1 , 2 , 3 , 4 , 5
1 , 23 , 4 , 5
thanksHere are two examples
http://msdn.microsoft.com/en-us/library/ms191250.aspx
calulated
http://msdn.microsoft.com/en-us/library/ms191250.aspx
Gary Newman MCSE, MCT, CCNA, MCSD, MCPD, MCDBA, MCAD, MCSA, MCTS Developer and Administrator On SharePoint 2013 SharePoint Practice Manager for AmeriTeach Denver, CO. -
HOW to read file using ftp???
Hi to all,
I have problem with reading file using ftp connection, i want to read only 1024 bytes for one time, and i have
next code wich read this:
byte buffer[] = new byte[1024];
while( (readCount = input.read(buffer)) > 0) {
bos.write(buffer, 0, readCount);
but I dont know how to put all read data in one byte[] if i dont know length of file.
I can't do some like: byte file[] = new file[1000000];
Thanks for all sugestions!* Download a file from a FTP server. A FTP URL is generated with the following syntax:
* <code>ftp://user:password@host:port/filePath;type=i</code>.
* @param ftpServer FTP server address (incl. optional port ':portNumber').
* @param user Optional user name to login.
* @param pwd Optional password for <i>user</i>.
* @param fileName Name of file to download (with optional preceeding relative path, e.g. one/two/three.txt).
* @param destination Destination file to save.
* @throws MalformedURLException, IOException on error.
public void download(String ftpServer, String user, String pwd, String fileName, File destination) throws MalformedURLException, IOException {
if (ftpServer != null && fileName != null && destination != null) {
StringBuffer sb = new StringBuffer("ftp://");
if (user != null && pwd != null) { //need authentication?
sb.append(user);
sb.append(':');
sb.append(pwd);
sb.append('@');
}//else: anonymous access
sb.append(ftpServer);
sb.append('/');
sb.append(fileName);
sb.append(";type=i"); //a=ASCII mode, i=image (binary) mode, d= file directory listing
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
URL url = new URL(sb.toString());
URLConnection urlc = url.openConnection();
bis = new BufferedInputStream(urlc.getInputStream());
bos = new BufferedOutputStream(new FileOutputStream(destination.getName()));
int i;
while ((i = bis.read()) != -1) { //read next byte until end of stream
bos.write(i);
}//next byte
} finally {
if (bis != null) try { bis.close(); } catch (IOException ioe) { /* ignore*/ }
if (bos != null) try { bos.close(); } catch (IOException ioe) { /* ignore*/ }
}//else: input unavailable
}//download()If you don't want to strore the data into a file, use ByteArrayOutputStream instead of a FileOutputStream. -
How to Append two word documents into single using java
How to Append two word documents into single using java
we tried this but it's not append the one word document to other
source code:public class AppendTwoWordFiles {
public static void main(String []arg)throws IOException
FileInputStream fi=null;
FileOutputStream fo=null;
try {
System.out.println("Enter the source file name u want to append");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
File f1=new File(br.readLine().toString());
System.out.println("Enter the Destination file name ");
File f2=new File(br.readLine().toString());
fi = new FileInputStream(f1);
fo = new FileOutputStream(f2,true);
byte b[]=new byte[2];
while((fi.read(b))!=-1);
fo.write(b);
System.out.println("Successfully append the file");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
finally{
fi.close();
fo.close();
plz reply me quickly ,,,what can i followUse this code ..
and give the path of the both file like this.....
source file ---- C:/workspace/Practice/src/com/moksha/ws/test/practice.text
destination file ---- C:/workspace/City/src/com/moksha/ws/test/practice1.text
import java.io.*;
public class AppendTwoWordFiles {
public static void main(String[] arg) throws IOException {
FileInputStream fi = null;
FileOutputStream fo = null;
try {
System.out.println("Enter the source file name u want to append");
BufferedReader br = new BufferedReader(new InputStreamReader(
System.in));
File f1 = new File(br.readLine().toString());
System.out.println("Enter the Destination file name ");
File f2 = new File(br.readLine().toString());
fi = new FileInputStream(f1);
fo = new FileOutputStream(f2, true);
byte b[] = new byte[2];
int len = 0;
while ((len = fi.read(b)) > 0) {
fo.write(b, 0, len);
System.out.println("Successfully append the file");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
fi.close();
fo.close();
} -
How to get Document Set property values in a SharePoint library in to a CSV file using Powershell
Hi,
How to get Document Set property values in a SharePoint library into a CSV file using Powershell?
Any help would be greatly appreciated.
Thank you.
AA.Hi,
According to your description, my understanding is that you want to you want to get document set property value in a SharePoint library and then export into a CSV file using PowerShell.
I suggest you can get the document sets properties like the PowerShell Command below:
[system.reflection.assembly]::loadwithpartialname("microsoft.sharepoint")
$siteurl="http://sp2013sps/sites/test"
$listname="Documents"
$mysite=new-object microsoft.sharepoint.spsite($siteurl)
$myweb=$mysite.openweb()
$list=$myweb.lists[$listname]
foreach($item in $list.items)
if($item.contenttype.name -eq "Document Set")
if($item.folder.itemcount -eq 0)
write-host $item.title
Then you can use Export-Csv PowerShell Command to export to a CSV file.
More information:
Powershell for document sets
How to export data to CSV in PowerShell?
Using the Export-Csv Cmdlet
Thanks
Best Regards
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected]
Maybe you are looking for
-
Cannot get progress to show in app store download of Mountain Lion
Having to re-download Mountain Lion on my mid 2009 MBP from overseas. The ML app shows "downloading" in dock with progress bar under it (and just a hint of blue for hours now), but in the App Store on the Purchases tab it just shows the Mountain Lion
-
Error while running autoconfig in DBtier
Hi , While running a autoconfig on DBTier we got the following errror : The following report lists errors AutoConfig encountered during each phase of its execution. Errors are grouped by directory and phase. The report format is: <filename> <phase> <
-
Possible to render a UIView into a bitmap without attaching it to a window?
Hi all, I am trying to capture the visual output of a UIView into a bitmap which I can save to a file. However, it seems that all the information I have about rendering a UIView requires it to be attached to an UIWindow to give it a backing surface.
-
CONVERT_OTF_2_PDF performance issue!
Hi friends! We are trying to convert a Smart Form to a PDF using CONVERT_OTF_2_PDF Function Module and it is working fine but we are facing performance issue with that. This process is taking a little longer than expected, could you please provide so
-
Getting a new Intel Mac, Logic question
I currently run Logic Studio on my dual G4, which is finally starting to die on me. I am going to be getting one of the quad Mac Pros soon, and I wanted to make sure that my current Logic Studio will install on it. In other words, does the move to 10