Concatenate output in shell script

Hi Colleagues,

I need the help in the followind.
I execute this.

select count(*) from schema.tablew

the output is this.

select count(*) from schema.table
       3955

I need the followind output.

select count(*) from schema.table        3955

Thank you for you help.

Your requirement is not very clear to me. I am guessing your output is like:

COUNT(*)
----------
3955

and you want it to be just 3955 so that you can store it in variable ? if so just add set head off at starting of your sql.

Excuse me my english is very bad, I execute this statement.

select count(*) from schema.table

I need this output.

select count(*) from schema.table        3955

Thank you for advanced.

set pages 0
select 
  'select count(*) from schema.table ' ||  
  count(*) 
from 
  schema.table;

When i execute this statements,

select count(*) from PP1.A0IMPRTD with UR;
select count(*) from PP1.PROPAGACIONES with UR;
select count(*) from PP1.A0SVCRTD with UR;
select count(*) from PP1.HIT_RATIO with UR;
select count(*) from PP1.A0IMGRTD with UR;
select count(*) from PP1.A0RUTATD with UR;
select count(*) from PP1.A0UNSSTD with UR;

Obtain this output is this.

select count(*) from PP1.A0IMPRTD with UR
 76
select count(*) from PP1.PROPAGACIONES with UR
60002
select count(*) from PP1.A0SVCRTD with UR 
25
select count(*) from PP1.HIT_RATIO with UR
22996
select count(*) from PP1.A0IMGRTD with UR 
225
select count(*) from PP1.A0RUTATD with UR
331594
select count(*) from PP1.A0UNSSTD with UR 
13124
select count(*) from PP1.OPTIMA_SERVICIOS with UR
5171
select count(*) from PP1.A0CONVTD with UR
 10997
select count(*) from PP1.A0MENSTD with UR
7219
select count(*) from PP1.A0TITRTD with UR
 6
select count(*) from PP1.A0TPARTD with UR
4
select count(*) from PP1.P60_INI with UR
 0
select count(*) from PP1.P60_FIN with UR
0

But i need this output.

select count(*) from PP1.A0IMPRTD with UR 76
select count(*) from PP1.PROPAGACIONES with UR 60002
select count(*) from PP1.A0SVCRTD with UR 25
select count(*) from PP1.HIT_RATIO with UR 22996
select count(*) from PP1.A0IMGRTD with UR 225
select count(*) from PP1.A0RUTATD with UR 331594
select count(*) from PP1.A0UNSSTD with UR 13124
select count(*) from PP1.OPTIMA_SERVICIOS with UR 5171
select count(*) from PP1.A0CONVTD with UR 10997
select count(*) from PP1.A0MENSTD with UR 7219
select count(*) from PP1.A0TITRTD with UR  6
select count(*) from PP1.A0TPARTD with UR 4
select count(*) from PP1.P60_INI with UR  0
select count(*) from PP1.P60_FIN with UR 0

Thank you for advanced.

you should try the syntax mentioned by @radoulov in post#4

Pass the input through this script:

sed 'N;s/\n/ /'

Hi colleagues,
This is my file count_records.sql, that contain this.

set pages 0
select 'select count(*) from PP1.A0PROVTD ' || count(*) from PP1.A0PROVTD;

I execute in this way and show me this error.

db2 -tvsf count_records.sql |tee count_records.log
set pages 0 select 'select count(*) from MIATLAS.A0PROVTD ' || count(*) from MIATLAS.A0PROVTD
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "set pages 0" was found following
"BEGIN-OF-STATEMENT".  Expected tokens may include:  "<space>".
SQLSTATE=42601

Somebody can help me, please.
Thank you for adavnced.

OK,
this is db2.
Try passing the output from your original script through the sed command.