05-04-2007
Please explain this code snippet to me
Hi all,
I am new to shell scripting and want to know how this code works.
{
echo "set pagesize 0"
echo "SELECT empno||','||ename||','||job||','||mgr||hiredate||','||sal||','||comm||','||deptno "\
"FROM emp;"
} | sqlplus -s $username/$password@$database >> $root_dir/$csv_file1
Thanks in advance.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi. Im using cat to output the contents of a file, then piping it to my while read loop.In this loop variables get assigned values. However when i try to use the variables outside the loop their values has been reset.I understand about subshells etc. but I have no idea how to "preserve" the... (3 Replies)
Discussion started by: Ultimodiablo
3 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I did not understand why the following did not work out as I expected:
find . -name "pqp.txt" | grep -v "Permission"
I thought I would be able to catch whichever paths containing my pqp.txt file without receiving the display of messages such as "find: cannot access... Permisson... (1 Reply)
Discussion started by: 435 Gavea
1 Replies
3. Shell Programming and Scripting
Hi,
I was wondering why ls * | echo does not print the contents of the directory to the screen? The way I see it, ls * returns a whole lot of information, and then we pipe all this info to echo, so surely it should all come to our screen!
Is there a serious flaw in my understanding?
... (3 Replies)
Discussion started by: A1977
3 Replies
4. Shell Programming and Scripting
Not sure why this does not work in bash:
tail -f err.log |&
-bash: syntax error near unexpected token `&'
I am attempting to continuously read a file that is being updated by doing a "tail -f" on the file and piping the output to stdin which can then be read by the next shell command
Thnx (4 Replies)
Discussion started by: anuramdas
4 Replies
5. Shell Programming and Scripting
Hi.
I have a script like so:
#!/bin/bash
download='php /var/www/last.php'
echo $download
if $downloadHow do I pipe the output of the php file into a variable, as when i run the if statement, it just echos the file output to the screen and does not actually consider the output (it will be... (2 Replies)
Discussion started by: daydreamer
2 Replies
6. Shell Programming and Scripting
Hi All,
I am trying to convert the below Csh code into Perl.
But i have the following error.
Can any expert help ?
Error:
ls: *tac: No such file or directory
Csh
set $ST_file = `ls -rt *$testid*st*|tail -1`;
Perl
my $ST_file = `ls -rt *$testid*st*|tail -1`; (10 Replies)
Discussion started by: Raynon
10 Replies
7. Fedora
I would like to pipe "top -n" to a text file, but I get an error:
top: cannot open /dev/kmem
kvm_open: Permission denied
I am a non-root user.
If I could find a way to get this type of output:
"Memory: 2048M real, 1516M free, 4099M swap free"
into a text file, I could further automate... (13 Replies)
Discussion started by: safraser
13 Replies
8. Shell Programming and Scripting
Ok, so there is a perl script that runs as a server, on my local host. It tells me which port to use. I want to pipe that output into my browser so I can do the whole thing with a single command. The problem is, I think, that the program doesn't actually exit cause it's running a server, so...... (6 Replies)
Discussion started by: ninjaaron
6 Replies
9. Shell Programming and Scripting
Basically I was wondering if any of you know how to pipe the output of ls to a text file? so in my shell script one of the lines is ls but i want to pipe it into a file called directory listing.
Cheers.
I have tried ls | Directorylisting.txt
but it keeps saying " line 7: DirectoryListing.txt:... (9 Replies)
Discussion started by: LinuxNubBrah
9 Replies
10. Shell Programming and Scripting
i have a file seperated each line seperated by newline. For example
alpha
beta
gamma
i am trying to replace the newlines to "," but dont want , present at the end of the line so i am trying the below one liner . but not sure whats wrong but its not working
cat myfile | tr -s '\n' ',' | sed... (9 Replies)
Discussion started by: chidori
9 Replies
LEARN ABOUT DEBIAN
zone2sql
ZONE2SQL(8) System Manager's Manual ZONE2SQL(8)
NAME
zone2sql - Convert ISC Bind zones to SQL
SYNOPSIS
zone2sql [OPTIONS]
DESCRIPTION
Zone2sql parses Bind named.conf files and zonefiles and outputs SQL on standard out, which can then be fed to your database.
zone2sql understands the Bind master file extension '$GENERATE' and will also honour '$ORIGIN' and '$TTL'.
For backends supporting slave operation (currently only the PostgreSQL backend), there is also an option to keep slave zones as slaves, and
not convert them to native operation.
By default, zone2sql outputs code suitable for the mysqlbackend, but it can also generate SQL for the Generic PostgreSQL and Oracle back-
ends.
OPTIONS
Input options:
--named-conf=<filename>
Read <filename> to get the bind configuration
--zone=<zone-file>
Parse only this zone file. Conflicts with --named-conf parameter.
--zone-name=<name>
When parsing a single zone without $ORIGIN statement, set this as the zone name.
Output options:
--bare Output in a bare format, suitable for further parsing. The output is formatted as follows:
domain_id<TAB>'qname'<TAB>'qtype'<TAB>'content'<TAB>prio<TAB>ttl
--gmysql
Output in format suitable for the default configuration of the Generic MySQL backend.
--gpgsql
Output in format suitable for the default configuration of the Generic PostgreSQL backend.
--mysql
Output in format suitable for the default configuration of the MySQL backend (the default output format).
--oracle
Output in format suitable for the default configuration of the Generic Oracle backend.
--transactions
For Oracle and PostgreSQL output, wrap each domain in a transaction for higher speed and integrity.
Other options:
--slave
Maintain slave status of zones listed in named.conf as being slaves. The default behaviour is to convert all zones to native opera-
tion.
--on-error-resume-next
Ignore missing files during parsing. Dangerous.
--help List all options
--verbose
Be verbose during conversion.
SEE ALSO
pdns_server(8)
PowerDNS December 2002 ZONE2SQL(8)