03-09-2009
Ahhh, so it works back from the end until it hits a non-number character.
Brilliant, thanks!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Not sure why this thread was closed without any explanation, but you can do what you're asking with sed 's/]*$//g' < sourceFile > destFile (1 Reply)
Discussion started by: oombera
1 Replies
2. Shell Programming and Scripting
Hi All
I have a file of the following format (delimited by |)
this is field 1 | field 2 (lots of blank spaces) | field 3 (lots of blank space) |
field 1 | more text (lots of blank spaces) | dhjdsk |
Is there a way I can remove... (6 Replies)
Discussion started by: djkane
6 Replies
3. Shell Programming and Scripting
So, I can't figure out how to do a previous question with printf, so I'm taking a different approach. Suppose I have a set of numbers:
1200,135.000000,12.30100,3212.3200,1.759403,,1230,101.101010,100.000000
I want to remove all trailing zeroes after the decimal, and, if it ends up orphaned,... (8 Replies)
Discussion started by: treesloth
8 Replies
4. Shell Programming and Scripting
Hello All,
I have a csv file with 3 columns. The file which looks like this
47850000,100,233
23560000,10000,456
78650000,560000,54
34000000,3456,3
The first column has 4 trailing zeros. I have to remove 4 trailing zeroes from 1st field. The output file should appear as follows.
... (12 Replies)
Discussion started by: grajp002
12 Replies
5. UNIX for Dummies Questions & Answers
Hi
I have 3 files (say) in a folder as in the example below
abc_01012011.csv
def_01012011.csv
xyz_01012011.csv
I need to move these files to a different folder as follows
abc.csv
def.csv
xyz.csv
I am trying to put together a script with a for loop which reads the source filenames... (5 Replies)
Discussion started by: bobsn
5 Replies
6. Shell Programming and Scripting
Hi all,
I haven't needed to do any shell based editing for nearly 20 years, and no amount of searching around has found me a solution to this very simple problem :-(
I have a csv file.
Some lines have three commas at the end. This means the invoice hasn't been paid.
I'd like to use sed / grep... (4 Replies)
Discussion started by: chardyzulu
4 Replies
7. UNIX for Dummies Questions & Answers
I have been given a shell script that I need to amend. To do the following
extract the filename from the flag file by removing the .flag extension.
# Local variables
# Find if the flag files exists
MASK=coda_mil2*.flag
# Are there any files?
bookmark="40"
fileFound=0
ls -1... (3 Replies)
Discussion started by: andymay
3 Replies
8. UNIX for Dummies Questions & Answers
I am trying to remove trailing carriage return (x'0a') from a source program. What is a good way to do this for the whole file?
TIA (4 Replies)
Discussion started by: wbport
4 Replies
9. Shell Programming and Scripting
I have been trying to remove empty lines and lines just filled with spaces. I have used the following command which does work.
sed -i "/^\s*$/d"
Except it leaves one single trailing line at the very end of the file. For the life of me I cant figure out why I cant remove that last trailing... (2 Replies)
Discussion started by: user8282892
2 Replies
10. UNIX for Beginners Questions & Answers
Hi All ,
I am having an input file as stated below
5728 U_TOP_LOGIC/U_CM0P/core/u_cortexm0plus/u_top/u_sys/u_core/r03_q_reg_20_/Q 011
611 U_TOP_LOGIC/U_CM0P/core/u_cortexm0plus/u_top/u_sys/u_core/r04_q_reg_20_/Q 011
3486... (4 Replies)
Discussion started by: kshitij
4 Replies
LEARN ABOUT DEBIAN
pg_tapgen
PG_TAPGEN(1p) User Contributed Perl Documentation PG_TAPGEN(1p)
Name
pg_tapgen - Generate schema TAP tests from an existing database
Usage
pg_tapgen -d template1 > schema_test.sql
Description
"pg_tapgen" is a command-line utility to generate pgTAP tests to validate a database schema by reading an existing database and generating
the tests to match. Its use requires the installation of the DBI and DBD::Pg from CPAN or via a package distribution.
Warning: These prerequisites are not validated by the pgTAP "Makefile", so you'll need to install them yourself. As a result, inclusion of
this script in the pgTAP distribution is experimental. It may be moved to its own distribution in the future.
Options
-d --dbname DBNAME Database to which to connect.
-U --username USERNAME Username with which to connect.
-h --host HOST Host to which to connect.
-p --port PORT Port to which to connect.
-v --verbose Display output of test scripts while running them.
-N --exclude-schema Exclude a schema from the generated tests.
-H --help Print a usage statement and exit.
-m --man Print the complete documentation and exit.
-V --version Print the version number and exit.
Options Details
"-d"
"--dbname"
pg_tapgen --dbname try
pg_tapgen -d postgres
The name of database to which to connect. Defaults to the value of the $PGDATABASE environment variable or to the system username.
"-U"
"--username"
pg_tapgen --username foo
pg_tapgen -U postgres
PostgreSQL user name to connect as. Defaults to the value of the $PGUSER environment variable or to the operating system name of the
user running the application.
"-h"
"--host"
pg_tapgen --host pg.example.com
pg_tapgen -h dev.local
Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory
for the Unix-domain socket. Defaults to the value of the $PGHOST environment variable or localhost.
"-p"
"--port"
pg_tapgen --port 1234
pg_tapgen -p 666
Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the
value of the $PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.
"-v"
"--verbose"
pg_tapgen --verbose
pg_tapgen -v
Display standard output of test scripts while running them. This behavior can also be triggered by setting the $TEST_VERBOSE
environment variable to a true value.
"-N"
"--exclude-schema"
pg_tapgen --exclude-schema contrib
pg_tapgen -N testing -N temporary
Exclude a schema from the test generation. "pg_tapgen" always ignores "information_schema", as it is also ignored by pgTAP. But if
there are other schemas in the database that you don't need or want to test for in the database (because you run the tests on another
database without those schemas, for example), use "--exclude-schema" to omit them. May be used more than once to exclude more than one
schema.
"-H"
"--help"
pg_tapgen --help
pg_tapgen -H
Outputs a brief description of the options supported by "pg_tapgen" and exits.
"-m"
"--man"
pg_tapgen --man
pg_tapgen -m
Outputs this documentation and exits.
"-V"
"--version"
pg_tapgen --version
pg_tapgen -V
Outputs the program name and version and exits.
Author
David E. Wheeler <dwheeler@cpan.org>
Copyright
Copyright (c) 2009-2011 David E. Wheeler. Some Rights Reserved.
perl v5.14.2 2012-06-10 PG_TAPGEN(1p)