Sponsored Content
Full Discussion: "sed" ignoring last line
Top Forums Shell Programming and Scripting "sed" ignoring last line Post 302743729 by darling on Thursday 13th of December 2012 07:23:07 AM
Old 12-13-2012
"sed" ignoring last line

Hi,

I am giving below command script and getting below output. I tried using "sed" which is ignoring 4th line. Can you please help me to get the expected output like below
Code:
Code:
echo "dis clusqmgr(*) cluster(BT.CL.OFSSTAT4) conname qmtype deftype"| runmqsc -e $QMGR|egrep 'CHANNEL|QMTYPE|CLUSQMGR|CONNAME|DEFTYPE'|sed -e 's/CLUSQMGR(/+/g'|sed -e 's/CLUSQMGR(/+/g'|tr -d "\n"|tr "+" "\n"

Getting Output:

Please note QMTYPE(REPOS) is coming down and then again SU* is coming in next line
Code:
SU.QM.EMB70xtx)                CHANNEL(OFSSTAT4.EMB70xtx.Cx)   CLUSTER(SU.CL.OFSSTAT4)                 CONNAME(x0.N9.70.x0(Tx43x))   DEFTYPE(CLUSSDRA) 
QMTYPE(REPOS)
SU.QM.EMB70xtN)                CHANNEL(OFSSTAT4.EMB70xtN.Cx)   CLUSTER(SU.CL.OFSSTAT4)                 CONNAME(x0.N9.70.xx(Tx43N))   DEFTYPE(CLUSSDRB)
 QMTYPE(REPOS)
SU.QM.OFSMMxTx)                CHANNEL(OFSSTAT4.OFSMMxTx.Cx)   CLUSTER(SU.CL.OFSSTAT4)                 CONNAME(x0.x88.T8.9x(Tx43x))   DEFTYPE(CLUSSDRA)
 QMTYPE(NORMAL)
SU.QM.OFSMMxTN)                CHANNEL(OFSSTAT4.OFSMMxTN.Cx)   CLUSTER(SU.CL.OFSSTAT4)                 CONNAME(x0.x88.T8.94(Tx43N))   DEFTYPE(CLUSRCVR)                       
QMTYPE(NORMAL)

Expecting output:

Code:
SU.QM.EMB70xtx,                 OFSSTAT4.EMB70xtx.Cx,    SU.CL.OFSSTAT4,                  x0.N9.70.x0,Tx43x,    CLUSSDRA,                        REPOS,
SU.QM.EMB70xtN,                 OFSSTAT4.EMB70xtN.Cx,    SU.CL.OFSSTAT4,                  x0.N9.70.xx,Tx43N,    CLUSSDRB,                        REPOS,
SU.QM.OFSMMxTx,                 OFSSTAT4.OFSMMxTx.Cx,    SU.CL.OFSSTAT4,                  x0.x88.T8.9x,Tx43x,    CLUSSDRA,                        NORMAL,
SU.QM.OFSMMxTN,                 OFSSTAT4.OFSMMxTN.Cx,    SU.CL.OFSSTAT4,                  x0.x88.T8.94,Tx43N,    CLUSRCVR,                        NORMAL,


Last edited by Scrutinizer; 12-13-2012 at 08:28 AM.. Reason: quote tags -> code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Shell Programming and Scripting

"read" command ignoring leading spaces

I have to read a file line by line, change it and then update the file. Problem is, when i read the file, "read" command ignores leading spaces. The file is a script which is indented in many places for clarity. How to i make "read" command read leading spaces as well. (3 Replies)
Discussion started by: vickylife
3 Replies

3. Shell Programming and Scripting

SED or AWK "append line to the previous line"

Hi, How can I remove the line beak in the following case if the line begin with the special char “;”? TEXT Text;text ;text Text;text;text I want to convert the text to: Text;text;text Text;text;text I have already tried to use... (31 Replies)
Discussion started by: research3
31 Replies

4. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

7. Shell Programming and Scripting

Is it possible to use sed to handle the line contains BOTH "AA" and "BB"

if yes, can some expert give an example Lei (2 Replies)
Discussion started by: yanglei_fage
2 Replies

8. Shell Programming and Scripting

Find lines with "A" then change "E" to "X" same line

I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this... (10 Replies)
Discussion started by: nightwatchrenba
10 Replies

9. Shell Programming and Scripting

Delete all log files older than 10 day and whose first string of the first line is "MSH" or "<?xml"

Dear Ladies & Gents, I have a requirement to delete all the log files in /var/log/test directory that are older than 10 days and their first line begin with "MSH" or "<?xml" or "FHS". I've put together the following BASH script, but it's erroring out: for filename in $(find /var/log/test... (2 Replies)
Discussion started by: Hiroshi
2 Replies

10. Shell Programming and Scripting

Failure: if grep "$Var" "$line" inside while read line loop

Hi everybody, I am new at Unix/Bourne shell scripting and with my youngest experiences, I will not become very old with it :o My code: #!/bin/sh set -e set -u export IFS= optl="Optl" LOCSTORCLI="/opt/lsi/storcli/storcli" ($LOCSTORCLI /c0 /vall show | grep RAID | cut -d " "... (5 Replies)
Discussion started by: Subsonic66
5 Replies
JSONBOT(1)							    jsb manual								JSONBOT(1)

NAME
jsb-convore - The JSONBOT convore program SYNOPSIS
jsb-convore is a bot for the convore group chat network built on the JSONBOT framework. DESCRIPTION
jsb-convore connects to a convore group in much the same way as jsb-irc connects to an IRC channel. USAGE
Usage: jsb-convore [options] Options: --version show program's version number and exit -h, --help show this help message and exit -d DATADIR, --datadir=DATADIR datadir of the bot -o OWNER, --owner=OWNER owner of the bot -l LOGLEVEL, --loglevel=LOGLEVEL loglevel of the bot -p PASSWORD, --password=PASSWORD set password used to connect to the server -c CHANNEL, --channel=CHANNEL channel to join --name=NAME bot's name -u USERNAME, --username=USERNAME username of the bot DOCUMENTATION
See http://jsonbot.org for more documentation or see http://jsonbot.googlecode.com SEE ALSO
jsb(1), jsb-backup(1), jsb-init(1), jsb-irc(1), jsb-xmpp(1), jsb-fleet(1), jsb-sed(1), jsb-tornado(1), jsb-stop(1), jsb-udp(1), jsonbot(1) AUTHOR
This manual page was written by Jeremy Malcolm <terminus@debian.org>, for the Debian GNU/Linux system (but may be used by others). Debian GNU/Linux 22 Nov 2011 JSONBOT(1)
All times are GMT -4. The time now is 02:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy