Sponsored Content
Full Discussion: INTO OUTFILE Error 2
Top Forums UNIX for Beginners Questions & Answers INTO OUTFILE Error 2 Post 303036316 by esgaroth32 on Saturday 22nd of June 2019 06:06:44 PM
Old 06-22-2019
INTO OUTFILE Error 2

Good day, I am trying to run the following command but it does not seem to work.

Code:
[root@ ]# mysql -pPassword asteriskcdrdb -s -b -e "select 'Account ID','Destination','Operator','Provider','Date','BillSec','Rate id','Cost' UNION select accountcode,dst,'PBX',route_name,date_format(calldate,'%Y/%c/%e %H:%i'),billsec as Duration,route_id,round(cost,5) from cdr where calldate > '$prev_date' and calldate < '$cur_date' and cost > 0 and accountcode='$accountcode' UNION select '','','','','','',concat('R',sum(round(cost,5))),'' from cdr where calldate > '$prev_date' and calldate < '$cur_date' and cost > 0 and accountcode='$accountcode' INTO OUTFILE '/tmp/VoipBilling-$date/CDR/$accountcode-$date.csv' FIELDS TERMINATED BY ',';"

Error is: ERROR 1 (HY000) at line 1: Can't create/write to file '/tmp/VoipBilling-/CDR/-.csv' (Errcode: 2)

Note the filepath in the error code and the filepath specified differs. Almost as if Mariadb does not know to create the folder with the date i.e /tmp/VoipBilling-2019-06-22/CDR/BILLTEST-2019-06-22.csv''

Instead it wants to write it as '/tmp/VoipBilling-/CDR/-.csv'

When I run the same command but change the output path to not use the $date it works. i.e
Code:
[root@ ]# mysql -pPassword asteriskcdrdb -s -b -e "select 'Account ID','Destination','Operator','Provider','Date','BillSec','Rate id','Cost' UNION select accountcode,dst,'PBX',route_name,date_format(calldate,'%Y/%c/%e %H:%i'),billsec as Duration,route_id,round(cost,5) from cdr where calldate > '$prev_date' and calldate < '$cur_date' and cost > 0 and accountcode='$accountcode' UNION select '','','','','','',concat('R',sum(round(cost,5))),'' from cdr where calldate > '$prev_date' and calldate < '$cur_date' and cost > 0 and accountcode='$accountcode' INTO OUTFILE '/tmp/VoipBilling/CDR/accountcode.csv' FIELDS TERMINATED BY ',';"

So it is safe to say this is not a folder permision but the command not being able to create the folder with $date specified.

Please assist
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Setting outfile with (brackets)

I have a file that comes in as 20081002_invoices.txt and needs to go out as invoices(20081002).xls When ran this file should have three seperate fields as follows: column1 column2 column3 data1 data2 data3 when i run the script it produces the invoices(20081002).xls but moves... (1 Reply)
Discussion started by: Pablo_beezo
1 Replies

2. Shell Programming and Scripting

How to extract some parts of a file to create some outfile

Hi All, I am very new in programming. I need some help. I have one input file like: Number of disabled taxa: 9 Loading mapping file: ncbi.map Load mapping: taxId2TaxLevel: 469951 --- Subsample reads (20%): 66680 of 334386 Processing: tree-from-summary Running tree-from-summary... (21 Replies)
Discussion started by: iammitra
21 Replies

3. UNIX for Dummies Questions & Answers

How to outfile contant as an input for a command

I`m having output file which contain following no which changes every time i run script.The number given below are there in file and i have to fatch them from file. 12 15 56 158 365 165 598 568 265 256 258 now i want to use above number from output to input as $j r=`/omp/bin/ICIC... (1 Reply)
Discussion started by: nitin_aaa27
1 Replies

4. Shell Programming and Scripting

print to more than one outfile AWK

I'd like to do an if / else if condition and print to different files. Something like: awk '{ if ($1 == "yes") print $2, $4 < infile > outfile1 ; else if ($1 == "No") print $2, $4 < infile > outfile2 }' Obviously I don't know the syntax. Thanks so much. (5 Replies)
Discussion started by: dcfargo
5 Replies

5. Programming

"cout = outFile" is not compiled

Hello, Compilation of the line "cout = outFile" throws error "Error: std::ios_base::operator=(const std::ios_base&) is not accessible from std::ios ::operator=(const std::ios &)." outFile is declared as "static ofstream". Thanks, Shafi (3 Replies)
Discussion started by: shafi2all
3 Replies

6. Shell Programming and Scripting

Difference of two data files & writing to an outfile.

Hi Everyone, I have two files i.e. one file2 contains today's data and the other file1 contains Yesterday's data. The data in the files contains 226 columns and the data for the coulums separated by a Pipe "|" delimiter. Now, I have 4 Primary keys (coulumns) by which I have to compare file2 and... (10 Replies)
Discussion started by: filter
10 Replies

7. Shell Programming and Scripting

Copying the Header & footer Information to the Outfile.

Hi I am writing a perl script which checks for the specific column values from a file and writes to the OUT file. So the feed file has a header information and footer information. I header information isaround107 lines i.e. Starts with START-OF-FILE ....... so on .... ... (11 Replies)
Discussion started by: filter
11 Replies

8. UNIX for Dummies Questions & Answers

Outfile

Hi guys! So I have a program that allows the user to enter a file, change some characters (for example, a changes to t, etc.) and then save the new file under a new name. However, I need to press carriage return twice for the program to end. I was just wondering if anyone knew of a way for the... (2 Replies)
Discussion started by: PerlNutt
2 Replies

9. UNIX for Dummies Questions & Answers

xls2csv.py won't print to outfile

Hi, I'm trying to use pyExcelerator's module "xls2csv" converter in ubuntu. The following works great, except the standard out is in the terminal. sudo python xls2csv.py test.xls I want the csv delimited output to be redirected to a file. When I enter.... sudo python xls2csv.py test.xls... (5 Replies)
Discussion started by: jdilts
5 Replies

10. Solaris

Solaris 10 error "-sh: /tmp/outfile: cannot create"

Hello, Each time a user log on to host, they receive below error: -sh: /tmp/outfile: cannot create Example: $ ssh host user@host's password: Last login: Fri Dec 4 08:17:28 2015 from client.ref |-----------------------------------------------------------------| -sh:... (2 Replies)
Discussion started by: feroccimx
2 Replies
AnyEvent::XMPP::Error::MUC(3pm) 			User Contributed Perl Documentation			   AnyEvent::XMPP::Error::MUC(3pm)

NAME
AnyEvent::XMPP::Error::MUC - MUC error Subclass of AnyEvent::XMPP::Error METHODS type This method returns either: join_timeout If the joining of the room took too long. no_config_form If the room we requested the configuration from didn't provide a data form. subject_change_forbidden If changing the subject of a room is not allowed. message_error If this is an unidentified message error. If we got a presence error the method "presence_error" returns a AnyEvent::XMPP::Error::Presence object with further details. However, this class tries to provide a mapping for you (the developer) to ease the load of figuring out which error means what. To make identification of the errors with XEP-0045 more clear I included the error codes and condition names. Here are the more descriptive types: password_required Entering a room Inform user that a password is required. (Condition: not-authorized, Code: 401) banned Entering a room Inform user that he or she is banned from the room (Condition: forbidden, Code: 403) room_locked Entering a room Inform user that the room does not exist and someone is currently creating it. (Condition: item-not-found, Code: 404) room_not_creatable Entering a room Inform user that room creation is restricted (Condition: not-allowed, Code: 405) use_reserved_nick Entering a room Inform user that the reserved roomnick must be used (Condition: not-acceptable, Code: 406) not_on_memberlist Entering a room Inform user that he or she is not on the member list (Condition: registration-required, Code: 407) nickname_in_use Entering a room Inform user that his or her desired room nickname is in use or registered by another user (Condition: conflict, Code: 409) room_full Entering a room Inform user that the maximum number of users has been reached (Condition: service-unavailable, Code: 503) The condition and code are also available through the AnyEvent::XMPP::Error::Presence object returned by "presence_error", see below. text This method returns a human readable text if one is available. presence_error Returns a AnyEvent::XMPP::Error::Presence object if this error origins to such an error and not some internal error. message_error Returns a AnyEvent::XMPP::Error::Message object if this error origins to such an error and not some internal error. AUTHOR
Robin Redeker, "<elmex at ta-sa.org>", JID: "<elmex at jabber.org>" COPYRIGHT &; LICENSE Copyright 2007, 2008 Robin Redeker, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-01-23 AnyEvent::XMPP::Error::MUC(3pm)
All times are GMT -4. The time now is 09:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy