10-11-2009
New Line help needed
I am doing a simple SHOW DATABASES query:
#!/bin/bash
echo `mysql -e "SHOW DATABASES;"`
It produces this:
Database information_schema mysql test
There are 2 things I want to do, but failing at.
1. Exclude the header "Database information_schema"
2. add a new line between each database "\n"
I'm running into walls for both of them.
I've tried different ways to use tail +2 (echo `mysql -e "SHOW DATABASES;"` | tail +2) - but to no avail. And the new line is elusive.
Any thoughts?
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
can someone help me with the find and replace command.
I have a input file which is in the below format:
0011200ALN00000000009EGYPT 000000000000199900000
0011200ALN00000000009EGYPT 000000000000199900000
0011200ALN00000000008EGYPT 000000000000199800000
0011200ALN00000000009EGYPT ... (20 Replies)
Discussion started by: bsandeep_80
20 Replies
2. Shell Programming and Scripting
I have a file called vm.cfg which looks like follows
# cat vm.cfg
acpi = 1
apic = 1
builder = 'hvm'
device_model = '/usr/lib/xen/bin/qemu-dm'
disk =
kernel = '/usr/lib/xen/boot/hvmloader'
memory = '300'
name = 'vm_temp'
on_crash = 'restart'
on_reboot = 'restart'
pae = 1
serial =... (5 Replies)
Discussion started by: pinga123
5 Replies
3. Shell Programming and Scripting
I am writing a shell script that checks all .c files to see if they use fprintf or printf. If a file does, then the line #include <stdio.h> is added to the top of the file, unless it's already there.
This is what I've got:
#!/bin/sh
egrep -l f?printf *.c | while read file;
do sed -i '1i\... (2 Replies)
Discussion started by: computethis
2 Replies
4. Ubuntu
Hi,
having some problems getting commandline mail to work for root user in ubuntu.
Ive installed the following packages - msmtp & mailx and the cert for gmail.
I've created 3 files: mailrc and msmtprc in /home/username directory
and /etc/exim4/passwd.client
mailrc
------
set... (0 Replies)
Discussion started by: ziggycat
0 Replies
5. Shell Programming and Scripting
Hi Folks,
I was given a task to append three IP's at the end of a specific (and unique) line within a file on multiple servers.
I was not able to do that with the help of a script. All I could was:
for i in server1 server2 server3 server4
do
ssh $i
done
I know 'sed' could be used to... (5 Replies)
Discussion started by: momin
5 Replies
6. Shell Programming and Scripting
Hi,
How can i split a line of string into two lines.
I would like to format the below string:
Filesystem 1M-blocks Used Available Use% Mounted on /abc/def/xyz 34567 2345 12345 90% /test
to
Filesystem 1M-blocks Used Available Use% Mounted on
/abc/def/xyz 34567 2345 12345 90% /test
... (4 Replies)
Discussion started by: stunnerz_84
4 Replies
7. Shell Programming and Scripting
Hello Guys,
I request anyone to do me a small help in using diff command for following.
I am trying to compare two files for content and wish to keep the content after the comparison (The resultant file can't be blank)
However, the first lines would be different in both files and I need diff... (2 Replies)
Discussion started by: rockf1bull
2 Replies
8. Shell Programming and Scripting
Hi..wanted a help regarding inserting a newline in an xml file using shell script.
i've an xml file which has the following data.
1. <?xml version="1.0" encoding="UTF-8"?>
2. <group>
3. <name>odcm</name>
4. contd....
I need to insert two new lines after line#2, so that the output... (14 Replies)
Discussion started by: arjun_arippa
14 Replies
9. Shell Programming and Scripting
I have a file which has data in 8 lines:
10
34
6
1
4
46
67
31
I am trying to read each value into each different variable so that I use these variables in preparing my report.
Another option is to dynamically print each line values in the report like below:
users with privA:... (2 Replies)
Discussion started by: sarat949
2 Replies
10. Shell Programming and Scripting
Hi,
I had generated a report in my tool as followsoutput.txt
43.35
9
i needed the script to generate a new file like below
i want to append the text to each of these lines of my filenewoutputfile.txt should be
Total Amount : 43.35
Record Count:9
Regards,
Vasa Saikumar.
... (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies
LEARN ABOUT DEBIAN
dbix::searchbuilder::handle::mysql
DBIx::SearchBuilder::Handle::mysql(3pm) User Contributed Perl Documentation DBIx::SearchBuilder::Handle::mysql(3pm)
NAME
DBIx::SearchBuilder::Handle::mysql - A mysql specific Handle object
SYNOPSIS
DESCRIPTION
This module provides a subclass of DBIx::SearchBuilder::Handle that compensates for some of the idiosyncrasies of MySQL.
METHODS
Insert
Takes a table name as the first argument and assumes that the rest of the arguments are an array of key-value pairs to be inserted.
If the insert succeeds, returns the id of the insert, otherwise, returns a Class::ReturnValue object with the error reported.
SimpleUpdateFromSelect
Customization of "SimpleUpdateFromSelect" in DBIx::SearchBuilder::Handle. Mysql doesn't support update with subqueries when those fetch
data from the table that is updated.
DatabaseVersion
Returns the mysql version, trimming off any -foo identifier
CaseSensitive
Returns undef, since mysql's searches are not case sensitive by default
SimpleDateTimeFunctions
Returns hash reference with specific date time functions of this database for "DateTimeFunction" in DBIx::SearchBuilder::Handle.
ConvertTimezoneFunction
Custom implementation of "ConvertTimezoneFunction" in DBIx::SearchBuilder::Handle.
Use the following query to get list of timezones:
SELECT Name FROM mysql.time_zone_name;
Read docs about keeping timezone data up to date:
http://dev.mysql.com/doc/refman/5.5/en/time-zone-upgrades.html
AUTHOR
Jesse Vincent, jesse@fsck.com
SEE ALSO
DBIx::SearchBuilder, DBIx::SearchBuilder::Handle
perl v5.14.2 2011-09-21 DBIx::SearchBuilder::Handle::mysql(3pm)