Link to home
Start Free TrialLog in
Avatar of xy15973
xy15973

asked on

Unix Script Problem

This script retrun values into a txt file. I need to insert a delimter "^", Currently the delimiter is only added to the headings. How can I add it to the end of the actual data.

e.g

Val1  val2  val3
ss^  dd^   mm^

select substring(Task_Type,1,10)"Type^",
       substring(Job_Name,1,10)"Jobname^",
       substring(MemName,1,30)"Member^",
       substring(W_Day_Str,1,15)"Week Days^" ,
       substring(Days_Cal,1,10)"Calendar^",
       substring(Group_Name,1,30)"Group^",
       substring(Description,1,60)"Description^",
       substring(Node_Id,1,12)"Data Center^" from def_job

Thanks
Avatar of pmathinos
pmathinos

Change this line to reflect your table/columns and try it:

e.g:
SELECT SUBSTR(NUMDATA,4,4)||'^ '||UPLINK||'^ '||DOWNLINK||'^ '||TOTAL
FROM TEMP_TABLE

will give you:

9480^ 0^ 0^ 0
9478^ 1170^ 58^ 1228
9470^ 0^ 0^ 0
9422^ 0^ 0^ 0
9473^ 0^ 0^ 0
9445^ 1281^ 366^ 1647
9472^ 0^ 0^ 0
9480^ 0^ 0^ 0
9479^ 0^ 0^ 0

pmathinos.
Avatar of xy15973

ASKER


Will this work?

select substring(Task_Type,1,10)||"^"||Type ,
       substring(Job_Name,1,10)||"^"||Jobname ,
       substring(MemName,1,30)||"^"||Member ,
       substring(W_Day_Str,1,15)||"^"||"Week Days" ,
       substring(Days_Cal,1,10)||"^"||"Calendar",
       substring(Group_Name,1,30)||"^"||"Group",
       substring(Description,1,60)||"^"||"Description",
       substring(Node_Id,1,12)||"^"||"Data Center" from def_job
go
ASKER CERTIFIED SOLUTION
Avatar of pmathinos
pmathinos

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial