Sponsored Content
Top Forums Shell Programming and Scripting Formatting a DB unl file for easy readiblity Post 302156563 by gratus on Tuesday 8th of January 2008 02:12:10 PM
Old 01-08-2008
Formatting a DB unl file for easy readiblity

I have some database unload files (pipe delimited) that I need to extract some columns(or part of a column) and reformat and output them into a report file

right now I am inserting a tab between fields but since the lengths of fields vary significantly, the result is not very eye pleasing. Is there an easy one line formatter to print fields to fixed positions (i.e. column 2 starts at char 20)

echo " column 1 \t column 2 \t column 3" > $rpt_file
nawk ' {print " " $1 "\t" $2 "\t" substr($4, 1, 5)}' $db_unl_file >> $rpt_file

TIA

Last edited by gratus; 01-08-2008 at 06:01 PM..
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

easy question : how to install this file

hi, i want to add the gtk libraries into my Sun Solaris 8. So i got this file from http://www.sunfreeware.com/. glib-1.2.10-sol8-sparc-local.gz After i gzip -d it, i got the file below. glib-1.2.10-sol8-sparc-local then, what should i do ? how to continue? pls help me. thank... (1 Reply)
Discussion started by: champion
1 Replies

2. UNIX for Dummies Questions & Answers

Help with easy project - reading a file.

I need to do a project that is suppose to read a file and it is suppose to display the number of the line plus whatever the file is reading indented by a tab: example file: "This is the test file." expected output: 1 "This is 2 the test 3 file." I am having two... (1 Reply)
Discussion started by: lesgoodfella
1 Replies

3. UNIX for Dummies Questions & Answers

Need help on installing an EASY to use and easy to install command line text editor

Hi again. Sorry if it seems like I'm spamming the boards a bit, but I figured I might as well ask all the questions I need answers to at once, and hopefully at least get some. I have installed Solaris 10 on a server. The default text editors are there (vi, ex, ed, maybe others, I know emacs is... (4 Replies)
Discussion started by: EugeneG
4 Replies

4. Shell Programming and Scripting

grabbing filename from text file....should be easy!

Quick question...I'm trying to grab the .tif file name from this output from our fax server. What is the best way i can do this in a bash script? I have been looking at regular expressions with bash or using awk but having some trouble. thanks! The only output i want is... (5 Replies)
Discussion started by: kuliksco
5 Replies

5. Shell Programming and Scripting

File Formatting

Hi, Need to delete all the records prior to pattern (INSERT/UPDATE/DELETE). If ' is available, then need to retain it. Input ====================== l_s := ' INSERT INTO TEST' l_P PD := ' UPDATE INTO TEST' l_D := ' DELETE INTO TEST' This is test Input ======================... (1 Reply)
Discussion started by: saurabhbaisakhi
1 Replies

6. Shell Programming and Scripting

Easy way to pull a paragraph from a text file?

I have a collection of text files that comprise a mailing list archive. I grep them to find an email that interests me, then open the file in a text editor to find the surrounding paragraph of text. Is there an easy way to do this from the shell instead? (2 Replies)
Discussion started by: CRGreathouse
2 Replies

7. Shell Programming and Scripting

Formatting file data to another file (control character related)

I have to write a program to read data from files and then format into another file. However, I face a strange problem related to control character that I can't understand and solve. The source file is compose of many lines with such format: T_NAME|P_NAME|P_CODE|DOCUMENT_PATH|REG_DATE ... (3 Replies)
Discussion started by: hk6279
3 Replies

8. UNIX for Dummies Questions & Answers

Formatting data in a raw file by using another mapping file

Hi All, i have a requirement where i need to format the input RAW file ( which is CSV) by using another mapping file(also CSV file). basically i am getting feed file with dynamic headers by using mapping file (in that target field is mapped with source filed) i have to convert the raw file into... (6 Replies)
Discussion started by: ravi4informatic
6 Replies
MDBTools(1)															       MDBTools(1)

NAME
mdb-tables - Get listing of tables in an MDB database SYNOPSIS
mdb-tables [-S] [-1 | -d delimiter] database DESCRIPTION
mdb-tables is a utility program distributed with MDB Tools. It produces a list of tables contained within an MDB database in a format suitable for use in shell scripts. OPTIONS
-S Show system tables. System tables are generally those beginning with 'MSys' -1 specifies that the tables should be listed 1 per line. -d delimiter specifies an alternative delimiter. If no delimiter is specified, table names will be delimited by a tab character, or by newline if the -1 option was specified. NOTES
ENVIRONMENT
MDB_JET3_CHARSET Defines the charset of the input JET3 (access 97) file. Default is CP1252. See iconv(1). MDBICONV Defines the output charset. Default is UTF-8. mdbtools must have been compiled with iconv. MDBOPTS semi-column separated list of options: o use_index o no_memo o debug_like o debug_write o debug_usage o debug_ole o debug_row o debug_props o debug_all is a shortcut for all debug_* options HISTORY
mdb-tables first appeared in MDB Tools 0.3. SEE ALSO
gmdb2(1) mdb-export(1) mdb-hexdump(1) mdb-prop(1) mdb-sql(1) mdb-ver(1) mdb-array(1) mdb-header(1) mdb-parsecsv(1) mdb-schema(1) AUTHORS
The mdb-tables utility was written by Brian Bruns. BUGS
Access allows for tables to have spaces embeded in the table name. You must specify a delimiter (-d) if you intend on piping the output of mdb-tables to a program such as awk or cut. 0.7 13 July 2013 MDBTools(1)
All times are GMT -4. The time now is 01:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy