Okay, you first need to assess whether or not the mysql query went OK or not. Either "set -e" at the start of the script or deal with it when you run the query.
My MySQL is rusty but I checked and you can't run queries by just appending the query string - I get errors (which end up in my variable) when I do that. In stead, do something like:
Then instead of checking for the number of results, check if the string is empty.
You might also want to do a MySQL count statement (as opposed to a query) which may also be much better if the database is large. Additionally, when I do queries like that all my results end up on one line - you might want to append "limit 1" to your query to get just one result.
Hi ,
I am currently using the while loop in bash shell, as follows.
while read line
do
echo $line
done < file.txt
However, i want to use the while loop on file.txt, which will read the file with 4 lines of gap.
Ex- if file.txt is a file of 100 lines, then i want to use the loop such... (3 Replies)
I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends.
As an example I've written a script called question (The fist command is to show what is the contents of the... (2 Replies)
I'm trying to export a mysql query to a .csv file, right now I'm running a successful query like:
us_id=`mysql -u $USER_NAME --password=$PASSWORD -D "databasename" \
-e "SELECT * \
FROM databasename.table \
WHERE somefield >0 AND otherfield ='$ctry' \
ORDER BY... (1 Reply)
After doing a yum install mysql mysql-server on Fedora 14 I wasn't able to fully install the packages correctly. It installed MySQL 5.1. I was getting the following error when running the:
mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)... (3 Replies)
Hi,
I have a loop running until a variable L that is read previously in the full script. I'd like to grep some information in an input file at a line that contains the value of the loop parameter $i.
I've tried to use grep, but the problem is nothing is written in the FILE files. It seems grep... (5 Replies)
Dear mentors, I just need little explanation regarding for loop to give input to awk script
for file in `ls *.txt |sort -t"_" -k2n,2`; do
awk script $file
done
which sorts file in order, and will input one after another file in order to awk script
suppose if I have to input 2 or... (4 Replies)
In the bash when the user inputs an id to search for the bash currently closes, and if a match is found outputs a new file (match.txt). Is it possible to have not close the bash but rather, on the screen "searching for match" and if a match is found "match found in line.." is displayed... (3 Replies)
Is there a way to use a directory with multiple files (.bam) to create one new file? The below bash loop will create a new file (header.sam) for each of the bam files. However, I only need to use 1 of the bam file to make 1 header file. I attempted a code as well, but not sure if thats... (5 Replies)
HI
I have a dsv file that looks like:
<<BOF>>
record_number|id_number|first name|last name|msisdn|network|points|card number|gender
312|9101011234011|Test Junior|Smith|071 123 4321|MTN|73|1241551413214444|M
313|9012023213011|Bob|Smith|27743334321|Vodacom|3|1231233232323244|M... (4 Replies)
Cope sample1: test.sh
i=0
echo " Outside loop i = $i "
while
do
i=$(( $i + 1))
echo "Inside loop i = $i "
done
echo " Out of loop i is : $i "
When run output :
Outside loop i = 0
Inside loop i = 1
Inside loop i = 2
Inside loop i = 3
Inside loop i = 4
Inside loop i = 5
Inside... (8 Replies)
Discussion started by: Adarshreddy01
8 Replies
LEARN ABOUT DEBIAN
bp_meta_gff
BP_META_GFF(1p) User Contributed Perl Documentation BP_META_GFF(1p)NAME
bp_meta_gff.pl - Get/set Bio::DB::GFF meta-data
SYNOPSIS
# set the following meta data values
% bp_meta_gff.pl -d testdb tag1=value1 tag2=value2
# get the indicated meta data value
% bp_meta_gff.pl -d testdb tag1 tag2
DESCRIPTION
This script gets or sets metadata in a Bio::DB::GFF database. Not all adaptors support this operation! To set a series of tags, pass a
set of tag=value pairs to the script. To get the contents of a series of tags, pass the bare tag names.
The output from the get operation will be an easily parseable set of tag=value pairs, one per line.
COMMAND-LINE OPTIONS
Command-line options can be abbreviated to single-letter options. e.g. -d instead of --database.
--database <dsn> Mysql database name (default dbi:mysql:test)
--adaptor <adaptor> Mysql adaptor (default dbi::mysqlopt)
--user <user> Username for mysql authentication
--pass <password> Password for mysql authentication
SEE ALSO
Bio::DB::GFF
AUTHOR
Lincoln Stein, lstein@cshl.org
Copyright (c) 2002 Cold Spring Harbor Laboratory
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for
disclaimers of warranty.
perl v5.14.2 2012-03-02 BP_META_GFF(1p)