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
cvsd-passwd(8)						      System Manager's Manual						    cvsd-passwd(8)

NAME
cvsd-passwd - generate password entries for repositories SYNOPSIS
cvsd-passwd REPOS [+|-]NAME... DESCRIPTION
cvsd-passwd adds, updates or deletes users from repository passwd files for use with cvsd. OPTIONS
REPOS Specify the directory in which the repository is located. This argument can be the top of the repository, the CVSROOT directory or even the passwd file in the CVSROOT directory. [+]USER[:SUSER] Add or update the user to the CVSROOT/passwd file. If the user does not exist a password for the user is asked and the user is added for use with cvsd. If the user already exists a password for is asked and the password field is modified. The :SUSER part can be user to change or set mapping to a system user. If you do not specify anything, a reasonable default is used based upon your cvsd configuration. If you don't want to map the user to any specified system user you can specify an empty SUSER and use 'USER:'. -USER Remove the user from the CVSROOT/passwd file. EXAMPLES
Add an anoncvs user to access the given repository: cvsd-passwd /var/lib/cvsd/myrepos +anoncvs If the user already exists, change the password. Remove a user from the repository passwd list: cvsd-passwd /var/lib/cvsd/myrepos -foo Add a user and specify that cvs should remap this user to the joe system user: cvsd-passwd /var/lib/cvsd/myrepos joecvs:joe Note that the user joe should be known in the system passwd file and that cvsd should be run as root or user joe for this to work. SEE ALSO
cvsd(8) AUTHOR
Arthur de Jong <arthur@arthurdejong.org>. Version 1.0.24 Jun 2012 cvsd-passwd(8)
All times are GMT -4. The time now is 07:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy