[Solved] How to use delimiter


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [Solved] How to use delimiter
# 1  
Old 03-13-2012
[Solved] How to use delimiter

Hi,

I am using below script to get the below given output. But i am wondering how to pick the names from below output.

Script:
Code:
echo "dis ql(*) cluster(CT.CL.RIBRSBT3)"| runmqsc CT.QM.701t8|egrep QUEUE|sed -e 's/QUEUE(/ /'|sed -e 's/)/ /'

Output:
Code:
    CT.CL.RIBRSBT3.EMB.MBM_RIB_TO_ROBTESB_MC_REQ.01
    CT.CL.RIBRSBT3.EMB.MOP_RIB_TO_ROBTESB_MC_RES.01

from this output i want to get the names before TO and after TO. I want output like
below. AIB and
Expecting output
Code:
CT.CL.RIBRSBT3.EMB.MBM_RIB_TO_ROBTESB_MC_REQ.01,            RIB,            ROBTESB

Please help me out on this

Moderator's Comments:
Mod Comment Please use next time code tags for your code and data

Last edited by vbe; 03-13-2012 at 11:15 AM..
# 2  
Old 03-14-2012
try if the below helps..
Code:
echo "dis ql(*) cluster(CT.CL.RIBRSBT3)"| runmqsc CT.QM.701t8|egrep QUEUE| sed -e 's/QUEUE(/ /' -e 's/)/ /' -e 's/.*_\([^_]*\)_TO_\([^_]*\)_.*/&, \1, \2/'

# 3  
Old 03-14-2012
Thanks Its working

---------- Post updated at 04:33 AM ---------- Previous update was at 04:31 AM ----------

Thanks its is working

---------- Post updated at 04:36 AM ---------- Previous update was at 04:33 AM ----------

Can you please explain me what below part is doing in little brief
Code:
s/.*_\([^_]*\)_TO_\([^_]*\)_.*/&, \1, \2/'

---------- Post updated at 04:42 AM ---------- Previous update was at 04:36 AM ----------

It is working for only few. PFB
Code:
    CT.CL.ESBTCPTD.TCP.TCP_TO_ESB_OCD_REQ_VUL.01
    CT.CL.EXPTHT1.EMB.MOP_EXP_TO_TH_T2_REQ.01 , EXP, TH

I want the words of before _TO and after TO_

Last edited by Franklin52; 03-14-2012 at 07:15 AM.. Reason: Please use code tags for code and data samples, thank you
# 4  
Old 03-14-2012
Code:
 
echo "dis ql(*) cluster(CT.CL.RIBRSBT3)"| runmqsc CT.QM.701t8| nawk -F_ '/QUEUE/{print $0"\t"$2",\t"$4}'

# 5  
Old 03-14-2012
I am not getting any output it is showing some error

-ksh: nawk: not found [No such file or directory]
runmqsc: Signal SIGPIPE has been received:
the process will exit as soon as safely possible.
# 6  
Old 03-14-2012
use awk intead of nawk
# 7  
Old 03-14-2012
still its failing Smilie

CT.CL.CAMSTAT1.EMB.CAMSS_TO_STAA_PRO_RES_MODA.01
CT.CL.CAMSTAT1.EMB.CAMSS_TO_STAA_PRO_RES_MODB.02
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[Solved] Insert tabs as delimiter

Hello all, I have an unstructured file with space as delimiter , which I want to structure. The output file should actually have only 5 columns with tab as delimiter. The 4th column can have only 3 values ( biological_process , cellular_component , molecular_function ) Here is how the... (12 Replies)
Discussion started by: ritakadm
12 Replies

2. Shell Programming and Scripting

Perl Code to change file delimiter (passed as argument) to bar delimiter

Hi, Extremely new to Perl scripting, but need a quick fix without using TEXT::CSV I need to read in a file, pass any delimiter as an argument, and convert it to bar delimited on the output. In addition, enclose fields within double quotes in case of any embedded delimiters. Any help would... (2 Replies)
Discussion started by: JPB1977
2 Replies

3. UNIX for Dummies Questions & Answers

[Solved] How to swap PIPE seperator delimiter?

I have file like below 1|4|OR|OLAP|INT|INT||CONSTANT|2012/08/07|9999/12/31|0|0|0|0|PRL|-358.1684563||||||||||36522|55791|LNR| 2|4|OR|OLAP|CLR|CLR||CONSTANT|2012/09/07|9999/12/31|0|0|0|0|PRL|-358.1684563||||||||||36522|57891|REGS|... (2 Replies)
Discussion started by: gkskumar
2 Replies

4. Shell Programming and Scripting

Shell script to put delimiter for a no delimiter variable length text file

Hi, I have a No Delimiter variable length text file with following schema - Column Name Data length Firstname 5 Lastname 5 age 3 phoneno1 10 phoneno2 10 phoneno3 10 sample data - ... (16 Replies)
Discussion started by: Gaurav Martha
16 Replies

5. Shell Programming and Scripting

how to get everything before the last delimiter?

hi all, i have a string with a number of "/"s as delimiter. and i want everything BEFORE the last delimiter i know to use basename to get everything after the last delimiter. thx a lot! (2 Replies)
Discussion started by: sunnydanniel
2 Replies

6. Shell Programming and Scripting

How to cut by delimiter, and delimiter can be anything except numbers?

Hi all, I have a number of strings like below: //mnt/autocor/43°13'(33")W/ and i'm trying to get the numbers in this string, for example 431333 please help thanks ahead (14 Replies)
Discussion started by: sunnydanniel
14 Replies

7. Shell Programming and Scripting

Help regarding the delimiter

Hi, I am trying to load data from a file to oracle DB. The file am using has a ";" as a delimiter. While I load the file, I want to check whether the file is having the correct delimiter or not. if not, the file should not be processed. Is there any way that i could handle this scenario using... (3 Replies)
Discussion started by: smileyreddy
3 Replies

8. Shell Programming and Scripting

[solved] merging two files and writing to another file- solved

i have two files as file1: 1 2 3 file2: a b c and the output should be: file3: 1~a 2~b 3~c (1 Reply)
Discussion started by: mlpathir
1 Replies

9. Shell Programming and Scripting

Substring based on delimiter, finding last delimiter

Hi, I have a string like ABC.123.XYZ-A1-B2-P1-C4. I want to delimit the string based on "-" and then get result as only two strings. One with string till last hyphen and other with value after last hyphen... For this case, it would be something like first string as "ABC.123.XYZ-A1-B2-P1" and... (6 Replies)
Discussion started by: gupt_ash
6 Replies

10. UNIX for Dummies Questions & Answers

Delimiter

I am having the following file. I need to insert a delimiter in this file. I used sed but its not working. AAABBB 9 JJJ AAABBC 9 TTTTT AAABBA 8 JJJ AAABBC 7 TTTTT AAABBC 6 TTTTT Now i want the output file as: AAA|BBB| |9| |JJJ| AAA|BBC| |9| | |TTTTT| (3 Replies)
Discussion started by: sivakumar.rj
3 Replies
Login or Register to Ask a Question