Question about query


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Question about query
# 1  
Old 11-06-2008
Question about query

I am using SCO Unix, and inside have forte software which is similar with MySQL to store our product data. I am trying to print out serial number.

I use the following code and get result is like
Q>PRINT SERNUM WHERE ORDNUM=720385 USEKEY OE_ORDSER_KB
'T'erminal, 'P'rinter, or 'F'ile? T
Serial Number
----------------
P6GK1VXF
P6GKT0RF
P6GKTA3F
P6GKVXUF
P6GKVY2F
P6GKW21F
P6GKW2GF
P6GKYH4F
P6GKYP5F
P6GKYPKF
P6GKYPRF
P6GKYS4F
P6GKYSDF
P6GKYSNF
P6GKYWBF
P6GKYWPF
P6GKYYDF
P6GKYYPF
P6GKYZTF
P6GKZ17F
P6GKZ18F


This is right, but I want it horizontally to print out, one by one. How can I do? Who knows about this software?
# 2  
Old 11-06-2008
Select File instead of terminal.
Then use tr on the output file you just made
Code:
tr -s '\n' ' ' < myfile > newfile

newfile will have everything one one line.
# 3  
Old 11-06-2008
If you want to ignore the first 2 lines you can use sed with tr:

Code:
sed -n '3,$p' file | tr '\n' ' ' > newfile

or with awk:

Code:
awk 'NR > 2{printf("%s ", $0)}' file > newfile

 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script to execute Oracle query taking input from a file to form query

Hi, I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database. For instance: USER CITY --------- ---------- A CITY_A B CITY_B C ... (2 Replies)
Discussion started by: DevendraG
2 Replies

2. Shell Programming and Scripting

want to query : YES or NO

hi i want to make script. where i want to query from the user yes or no exp: do you want to proceed : y for yes n for NO. how this is possible in unix (3 Replies)
Discussion started by: dodasajan
3 Replies

3. Shell Programming and Scripting

Query Oracle tables and return values to shell script that calls the query

Hi, I have a requirement as below which needs to be done viz UNIX shell script (1) I have to connect to an Oracle database (2) Exexute "SELECT field_status from table 1" query on one of the tables. (3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Discussion started by: balaeswari
6 Replies

4. Shell Programming and Scripting

Query

hi i am producing txt outputs of archives created by our tsm software. problem is some of these files are too large to open in excel so i can despatch. here is a example of the output TAG_460 /prod_bak 7 FILE /ARCHIVE/Whistles- ... (4 Replies)
Discussion started by: treds
4 Replies

5. Shell Programming and Scripting

add the output of a query to a variable to be used in another query

I would like to use the result of a query in another query. How do I redirect/add the output to another variable? $result = odbc_exec($connect, $query); while ($row = odbc_fetch_array($result)) { echo $row,"\n"; } odbc_close($connect); ?> This will output hostnames: host1... (0 Replies)
Discussion started by: hazno
0 Replies

6. UNIX for Dummies Questions & Answers

Need Help on query

I just started to learn unix - need help to write a script to query a logfile and produce the results that contains a specific word "alarm" for a period from X day to Y day. I really have no idea how to begin - :( please help... ____________________________________________________ #... (1 Reply)
Discussion started by: snipfer
1 Replies

7. Shell Programming and Scripting

query.....

hi friends i want to know details of `exec` exact use of this command ..... actually i went through the man page but i didn`t get the satisfactory ...conclusion.... thaks in advance.... (1 Reply)
Discussion started by: newson
1 Replies

8. UNIX for Advanced & Expert Users

query

hello, i am working as aix system administrator, what is the major difference between aix and sun solaris ..os. what r the area difficult in solaris for aix administrator .............................. (1 Reply)
Discussion started by: varadakumar
1 Replies
Login or Register to Ask a Question