The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
0answers
20 views

Help query a db for cnames and remove blanks or duplicates

I am new to bash scripting and not sure how to accomplish this. I am trying to query a DB and need to remove empty strings as well as duplicates. The command I'm using mssql -f csv -c /path/to/mssql....
0
votes
0answers
12 views

SELECT statement issue with php [migrated]

+--------------+------+ | IP | Say | +--------------+------+ | 192.168.1.1 | 1 | +--------------+------+ $con = mysqli_connect("$host", "$user", "$pass", "$db_name") or die("cannot ...
0
votes
1answer
42 views

fill mySQL database with text file information

I have been using awk and some cisco commands to get information about devices connected to a network, the script connects via telnet to certain device, take the IP, serial number, and the name (...
0
votes
1answer
20 views

Unix variable not able to store sql query output

I am getting some issue when running sql from sqlplus and want to assign the o/p to a Unix variable.The Output is showing correct in log file but not assign to variable. code : PASSWD variable ...
0
votes
0answers
25 views

FreeBCP error: 'Cannot bcp with TDSVER < 5.0' - what's going on?

I am able to successfully write to my remote MS SQL database using Pandas to_sql and SQLAlchemy. However, when I'm in Ubuntu from the command line and try to bulk copy via: freebcp my_database.dbo....
0
votes
0answers
24 views

Calling SQL script from bash

I am using a bash script to load some .sql files (load.sh). One of the main sql files (main.sql) that gets loaded invokes another sql file. It has the following statement: @&1\Dir\file.sql ## ...
0
votes
1answer
12 views

Having trouble printing out concatenated data after using awk statement

I'm using Amazon Linux, bash shell. I have this statement, which extracts and prints the second row from a file with comma-delimited data ... awk -F',' 'select * FROM {print $2}' myfile.csv I would ...
0
votes
0answers
27 views

Working with Ubuntu Elasticsearch SQL plugin

Kindly check the following image and let me know what exactly is the problem while running the SELECT query with the sql plugin of Elasticsearch: Kindly, let me know your reply. Error while running ...
0
votes
0answers
59 views

Ksh: How to write the log file simultaneously when .sql file executes by UNIX process

We would like to implement an approach which has to write the log file simultaneously when the .sql file is executing by Unix process. At present, it is writing the log file once the process is ...
3
votes
2answers
82 views

Compare two sql output files which have column names and print the difference into another file

I am new to Unix Shell scripting. I need to write a shell script for comparing 2 sql output files (basically in .txt format) which are the outputs of the same sql query (before and after a maintenance ...
0
votes
1answer
46 views

Remove two columns of a SQL insert command in a dump file

I have a SQL dump file having several insert commands. I would like to remove, through sed or grep (or even another simple bash trick), a specific column and its equivalent data at the VALUES clause. ...
1
vote
0answers
75 views

Assigning a string variable from an SQL query to a shell variable [closed]

I was trying to assign a string variable in shell the result of an SQL query . I was trying to extract the first name of a customer from a table having customer details by the following query: ...
1
vote
3answers
210 views

Unix for loop multiple variables

I have a requirement of extracting the 2nd, 3rd and 4th field from a file aaa.log and producing output as - sqlplus -sl dbsnmp/Or8cle@\"COL3:COL4/COL2\" Input: $ cat aaa.log aaa:fDb:a0081:1800:...
0
votes
1answer
221 views

unexpected EOF while looking for matching `)'

I'm simply trying to get the output from a sql statement and store in bash variable. I am getting " unexpected EOF while looking for matching `)' " error. I don't see what i'm doing wrong. Why am I ...
1
vote
0answers
75 views

display unix variable with dbms_output.put_line

I have a loop with while that is reading a file and then make a query of these value but when I'm trying to show a message with dbms_output.put_line it says me : dbms_output.put_line(henry); ...
-2
votes
2answers
71 views

need help in shell shell scripting with oracle

I am trying to substitute a unix variable to a select statement, but I am getting the below error. What did I do wrong? sqlplus "/ as sysdba" << EOF spool /home/oracle/l.log archive log list; ...
3
votes
2answers
169 views

Nice way to SQL query multiple CSV files?

I was looking for a way to traverse CSV files as relational database tables. I did some research as nothing I found fit my bill of requirements in its entirety. I found several partially good options,...
2
votes
1answer
75 views

How to pretty-print CSV/spreadsheet from SQuirreL results?

I'm in a situation where I want to be able to take SQL query results from SQuirreL and paste them as ascii text into various forms and reports. With SQuirreL, I can export results as Excel or a CSV, ...
1
vote
1answer
176 views

Change column datatypes in Hive database

I am new to Hive database. Can someone please help me to change the datatype in Hive database? Below is a complete information about the same. I have a database named "test". It has a table "name". ...
0
votes
0answers
111 views

how to split the spooling into smaller csv files

I am using a shell script like the following to spool two columns(fields) of a particular table into a csv file as follow: #!/usr/bin/bash FILE="emp.csv" sqlplus -s scott/tiger@XE <<EOF SET ...
0
votes
1answer
139 views

How to use sqlformat tool with pgAdmin

I am trying to add external SQL formatting utility to pgAdmin. There is an option available in pgAdmin3 in Preferences -> Query tool -> Query editor called external formatting utility I set up ...
1
vote
2answers
94 views

How to log PostgreSQL table data changes into syslog?

I have a program which uses these tables, and I want to add some additional functionality to its logging without modifying the program. groups ------ id bigint not null name character varying(100) ...
1
vote
1answer
104 views

Escaping bash variables before storing them in an apache hive database

I'm running a script file sqoop_import_ATM.sh and would like to store the logs in a SQL database. First thing I did was to direct the logs into my own variable: OUTPUT="$(/home/me/...
1
vote
0answers
46 views

Input return key in an SQL script

I have an SQL script which when run prompts me to input a value. If I don't input any value and press the Enter/Return key, it will select the default value and will pull all the records. I am trying ...
-1
votes
1answer
28 views

Pick Values From A Oracle Select Query

I have executed the below command (Part of a 2 step procedure required for password reset when we face the error ORA-28007). SQL> select USER#,NAME,PASSWORD FROM user$ where name='TESTUSER'; ...
3
votes
0answers
148 views

Tomcat, SQL, Kerberos, oh my!

I am working on setting up Tomcat 8.0.35 on Ubuntu 16.04 with Oracle Java (not openjdk) 1.8.0_91-b14 to use Kerberos authentication when authenticating to our Microsoft SQL database. The issue I am ...
1
vote
1answer
68 views

Output broken when appending output of sql query in ksh

I'm very new to scripting. I would like to add the output of the sql function given below to another variable for example: month_end () { mdate=$($SQLPLUS_HOME/sqlplus.exe -S $DBC << END set ...
0
votes
1answer
69 views

How to write down SQL query to get the data count of a table?

I have one table named FDR_DATA. There are following fields present in the table. Fields are: B1_NAME, B2_NAME, B3_NAME, ELEMENT, DATUM, WERT. Now I want to query the total number of data in this ...
0
votes
1answer
201 views

How to populate a database in sqlite3 using shell script while extracting data from files

I have many .dat files containing specific fields such as <Overall>, <Content>, <Cleanliness> all with a number next to them. I have the code to be able to extract the data from ...
1
vote
2answers
115 views

Bash script - chomp parts out of a line

I have a data file (see sample three lines below) separated by pipes. What I want to be able to do is to "chomp" out the fields and put them into variables. They are of pre-defined lengths. I want to ...
6
votes
2answers
344 views

vim: Force specific syntax via command-line argument

When I want to easily read my PostgreSQL schema, I dump it to stderr and redirect it to vim: pg_dump -h localhost -U postgres dog_food --schema-only | vim - This gives: vim does not have a syntax ...
0
votes
2answers
277 views

Read SQL file by blocks in bash

I've been trying to do a string replacement type of operation in bash. It's not exactly as easy as it seems though, so here's the explanation: Say you have an SQL file with multiple SELECT statements ...
2
votes
1answer
63 views

How to read fields of a text block?

I would like to create sql inserts based on Radius log fields. For example, I have these two types of accounting logs and I'd like to convert each text block to an insert like below: INSERT INTO ...
0
votes
4answers
108 views

Run multiple piped grep commands from a list in bash

As part of my security job, I analyze dozens of Google Chrome history files each day using sqlite3 over SSH. There are a few dozen authorized "safe" sites each user is allowed to navigate to. For my ...
0
votes
1answer
136 views

unlang: SQL results to local variable

I'm trying to save a resultset of a SQL query in unlang. (First time with unlang for me, by the way, so please don't judge me for mistakes.) The corresponding line is Sql-Result-Set = %{expr: %{sql:...
1
vote
2answers
98 views

Complex sed Command with AND/OR/NOT

I have a bunch of php files which have many select commands. In each query i want to insert a coloumn variable admin_id = '$admin_id' i.e. if the query is select * from users where abc='xyz' and qwe='...
-2
votes
1answer
735 views

How do I use grep to search for strings that exist both on single lines and multiple lines?

I am searching large amounts of SQL scripts for data dependencies, but due to variations in the scripts, I have encountered an interesting problem. If I am searching for the word FROM, it only ...
-1
votes
1answer
2k views

Cannot run test program while cross compiling - cross compiling Firebird

I've tried to compile firebird server for arm linux, with cross-compiler (it's choosen - it's working properly). When using: ./autogen.sh --host=arm-linux-gnu I get this error: checking for ...
0
votes
1answer
86 views

Reading Multi Line SQL in UNIX

Currently, I am reading few queries from the below .sql file --SOURCE TABLE NAME --SOURCE QUERY SEL COL1, COL2, COL3, COL4, COL5, COL6, COL7 WHERE COL5 = '2015-11-04 16:24:00.000000' FROM ...
-2
votes
1answer
54 views

Physical Backup of Maria DB as a snapshot using LVM

I have a SQL database which I want to backup as a snapshot. I want to use LVM to do so, but I am not able to do it. Also my database is not stored in a LVM partition but its located in my /dev/sda2 ...
-1
votes
2answers
56 views

Putting output into SQL table

I am trying to convert the output of ps awux into 11 fields with the headers eliminated and then importing that output into an existing table in SQL.
0
votes
3answers
439 views

Use Command Line Argument and Variable with sed Inside Bash Script

I have a bash script that takes a bunch of command line arguments. The only one that matters in this context is the first, $1, which is a text file. The header is very long, below are examples of ...
0
votes
1answer
254 views

removing all tabs in sqlplus

I can resolve this problem, but I don't understand, why happen this... My task is: (in ksh) 1st step: Query a number from a DB with sqlplus, 2nd step: Format some text for a mail, 3rd step: send a ...
0
votes
1answer
455 views

How to delete the lines that starts with a specific word and end with a specific word

Eg: CREATE TABLE COMM.ACL_ENTRY ( ACL_OID CHAR(18) FOR BIT DATA NOT NULL , USER_DESC_TYPE FOR COLUMN USER_00001 BIGINT NOT NULL , USER_DESC_OID FOR COLUMN USER_00002 ...
-1
votes
1answer
156 views

When to use SQL or NoSQL databases? [closed]

The title of this question pretty sums it up. I am interesting in learning when to use a SQL database, such as MariaDB, and when to use a NoSQL one, such as MongoDB. Is there a specific case where one ...
0
votes
1answer
354 views

FreeTDS missing encryption support to connect to MS SQL

I'm running a Gentoo Linux and I'm trying to connect to MS SQL via pyodbc using freetds. I enabled the debug log in freetds. Now when I try to connect I'm seeing this: 18:13:00.841828 13523 (net.c:...
0
votes
1answer
114 views

How to return sequence value in sqlldr from unix shell

I have a test.txt file with column (Serialnumber,value). test.txt: "SEQ_IN_AMT.NEXTVAL",123123 "SEQ_IN_AMT.NEXTVAL",123114 here SEQ_IN_AMT is a sequence name create on Oracle. Now, when I load this ...
1
vote
2answers
3k views

Pass shell variables to SQL statement

I want to pass shell variables to an SQL statement. Both shell script and SQL statement are present in the same script file. I want the values of the variables retMonth, retLastDay and retPrvYear in ...
1
vote
1answer
441 views

Passing multiple varibles to a script for SQL query

I have this script called info_code: #!/bin/ksh if [ $# -eq 0 ] ;then echo "Enter code : \c" read code echo "" else code=$1 fi code=`echo ${code} | tr '[a-z]' '[A-Z]'` echo "select * from ...
1
vote
1answer
7k views

Redirect the output of a query in a file

How I can do to redirect the query result in a text file in sqlplus I tried: start requete.sql > resultat.txt but it dosen't work