Output Multiple Field from dataBase file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Output Multiple Field from dataBase file
# 1  
Old 08-31-2003
Computer Output Multiple Field from dataBase file

I am fairly new in unix I was wondering if anybody can help me out with this:

I am trying to output to a file the following fields;

Field1
Field2
Field4

From a database file dataBase1.
this is how the file looks:

dataBase1 TABLE DATA Example
==================


Table
------------------------------------
Field1 : XXXXXXXXXX
Field2 : XXXXXXXXXX
Field3 : XXXXXXXXXX
Field4 : XXXXXXXXX

I am however able to output the fields i wanted one by one by using

*dataBase1_dump -a |grep "Field1 : XXXXX" >filename.out

but I wanted to maybe like output the file in this format

Field1 : XXXXXXXXXX
Field2 : XXXXXXXXXX
Field4 : XXXXXXXXX

Smilie Thank You so much for taking the time looking into this guys.
# 2  
Old 09-01-2003
One possible way:

for x in 1 2 4
do
*dataBase1_dump -a | grep "Field$x" >> filename.out
done
# 3  
Old 09-01-2003
Hi,

A solution might be :

>/tmp/output
cat $file | grep -v "pattern from field 3" >>/tmp/output

I think for a better help we might need a little of your log-file. I don't know if you're searching for patterns or not.

Regs David
# 4  
Old 09-01-2003
Output Multiple Field from dataBase file

I believe this is what i was trying to say previously.

I have dataBase1.db
its a database for our subscribers.
Now we have a Tool for dumping this dataBase1 file
already and we are able to dump it into a file.

the file will Look Like this after using

dataBase1_dump -a >file.out <-- dataBase Tool.


dataBase1 TABLE DATA Example
==================


Table SUB
------------------------------------
Subscriber1 : 15DigitNumber
Field1 : 11DigitNumber
Field2 : 11DigitNumber
Field3 : X
Field4 : X
Field5 : 13DigitNumber
Field6 : 13DigitNumber
Field7 : 4DigitNumber
Subscriber2 : 15DigitNumber
Field1 : 11DigitNumber
Field2 : 11DigitNumber
Field3 : X
Field4 : X
Field5 : 13DigitNumber
Field6 : 13DigitNumber
Field7 : 4DigitNumber
Subscriber3 : 15DigitNumber
Field1 : 11DigitNumber
Field2 : 11DigitNumber
Field3 : X
Field4 : X
Field5 : 13DigitNumber
Field6 : 13DigitNumber
Field7 : 4DigitNumber

This will output a file with for now almost 13,000 subscribers.

WHat i need is to output:

( Line1 of output File ) Subscriber1
( Line2 of output File ) Field1 of Subscriber1
( Line3 of output File ) Field2 of Subscriber1
( Line4 of output File ) Field4 of Subscriber1
( Line5 of output File ) Subscriber2
( Line6 of output File ) Field1 of Subscriber2
( Line7 of output File ) Field2 of Subscriber2
( Line8 of output File ) Field4 of Subscriber2
( Line9 of output File ) Subscriber3
( Line10 of output File ) Field1 of Subscriber3
( Line11 of output File ) Field2 of Subscriber3
( Line12 of output File ) Field4 of Subscriber3

Up to subscriber 13,000...

Again Thank You for taking the time looking into this. It will be
a great help to me.

Last edited by Dennz; 09-01-2003 at 03:05 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Get output of multiple pattern match from first field to a file

Hi All, Greetings! I have a file of 40000+ lines with different entries, I need matching entries filterd out to their files based on first filed pattern for the matching : For example: All server1 entries (in field1) to come together with its path in 2nd field. The best output I want... (9 Replies)
Discussion started by: rveri
9 Replies

2. Shell Programming and Scripting

Grep from multiple patterns multiple file multiple output

Hi, I want to grep multiple patterns from multiple files and save to multiple outputs. As of now its outputting all to the same file when I use this command. Input : 108 files to check for 390 patterns to check for. output I need to 108 files with the searched patterns. Xargs -I {} grep... (3 Replies)
Discussion started by: Diya123
3 Replies

3. Linux

How do I format a Date field of a .CSV file with multiple commas in a string field?

I have a .CSV file (file.csv) whose data are all enclosed in double quotes. Sample format of the file is as below: column1,column2,column3,column4,column5,column6, column7, Column8, Column9, Column10 "12","B000QRIGJ4","4432","string with quotes, and with a comma, and colon: in... (3 Replies)
Discussion started by: dhruuv369
3 Replies

4. UNIX for Dummies Questions & Answers

ID incorrect field values in dat file and output to new file

Hi All I have a .dat file, the values are seperated by ". I wish to identify all field values in field 14 that are not '01-APR-2013' band then copy those records to a new file. Can anyone suggest the UNIX command required. Thanks in advance Andy (2 Replies)
Discussion started by: aurum1313
2 Replies

5. Shell Programming and Scripting

Plz Help. Compare 2 files field by field and get the output in another file.

Hi Freinds, I have 2 files . one is source.txt and second one is target.txt. I want to keep source.txt as baseline and compare target.txt. please find the data in 2 files and Expected output. Source.txt 1|HYD|NAG|TRA|34.5|1234 2|CHE|ESW|DES|36.5|134 3|BAN|MEH|TRA|33.5|234... (5 Replies)
Discussion started by: i150371485
5 Replies

6. Shell Programming and Scripting

Compare two files Field by field and output the result in another file

Hi Friends, Need Help. I have file1.txt as File1.txt |123|A|7267|Hyder|Cross|Sell|7801 |995|A|7051|2008|Lunar|New|Year|Promotion|7801 |996|A|7022|Q108|Targ|Prospect|&|SSCC|Savings|Promo|7801 |997|A|7182|Q1|Feb-Apr|08|Credit|ITA|PA|SBA|Campaign|7801 File2.txt... (7 Replies)
Discussion started by: i150371485
7 Replies

7. Shell Programming and Scripting

How to split file into multiple files using awk based on 1 field in the file?

Good day all I need some helps, say that I have data like below, each field separated by a tab DATE NAME ADDRESS 15/7/2012 LX a.b.c 15/7/2012 LX1 a.b.c 16/7/2012 AB a.b.c 16/7/2012 AB2 a.b.c 15/7/2012 LX2 a.b.c... (2 Replies)
Discussion started by: alexyyw
2 Replies

8. Shell Programming and Scripting

Handling multiple fields of a database file for toupper() function in awk

hello everyone.... script is: To convert the contents of a database file into uppercase my code is: printf "%s\n" , $2 | awk '{print toupper($2)}' emp.lst i m able to do only for one field.....didn't get any sources for handling multiple fields. please suggest me for multiple... (1 Reply)
Discussion started by: Priyanka Bhati
1 Replies

9. Shell Programming and Scripting

how to extract the data from database (oracle) and send the output as an .xls file?

Hi, How to extract the data from Oracle database and sent the output data to mails using mailx command with .xls attachement? Here i know how to connect the database using unix shell script and how to use the mailx command in UNIX script But i don't know how to use the .xls format file (i... (1 Reply)
Discussion started by: psiva_arul
1 Replies

10. Shell Programming and Scripting

check for the value of one particular field and give output in a different file

hi i need to check for the value of one particular field : in the output file. the file may contain many such records as below how to ???? *** Throttled with base name + key params! : : -518594328 : les.alarm.LBS12005 : les.alarm.LBS12005 : les : lessrv1 : les : 2328 : 0... (7 Replies)
Discussion started by: aemunathan
7 Replies
Login or Register to Ask a Question