Need to remove a character using sed

Hi All,

I have output like this below

ldprod/03
ldprod/02
ldprod/01
ldprod/00
ldnprod/
ldnprod/030

I want only remove all character including /

ldprod
ldprod
ldprod
ldprod
ldprod
ldnprod

ldnprod

You have finished in mod queue for you used fancy fonts...

sed 's:/.*::' yourfile

thanks i got this works

---------- Post updated at 09:39 AM ---------- Previous update was at 09:24 AM ----------

Hi All,

I am using multiple for loop's in my script but it is running more than one loop. Don�t know where i am doing mistake. Please help me on this.

for f in `cat rdf2-dg.txt`
do
symrdf -g $f query >> /home/srdf-query-report.txt
done
cat /home/srdf-query-report.txt|grep -i "Remote Symmetrix ID"|awk '{print $5}'> /home/sid.txt
cat /home/srdf-query-report.txt|grep -i "DEV001"|awk '{print $7}' > /home/dev.txt
for g in `cat /home/sid.txt`
do
for h in `cat /home/dev.txt`
do
symmaskdb -sid $g -dev $h list assign |grep FA |head -1|awk '{print $2}' > tt1.txt
done
done
for i in `cat tt1.txt`
do
symmaskdb -sid $g -wwn $i list devs >> /home/srdf-query-report.txt
symmaskdb -sid $g -wwn $i list devs|grep "User-generated Name"|awk '{print $4}'|sed "s/[/][0-9]*//" >tt2.txt
done
for j in `cat tt2.txt`
do
for k in `cat /home/sid.txt`
symmaskdb -sid $k -host $j list capacity >> /home/srdf-query-report.txt
done
done

I should get out put like this

Device Group (DG) Name : ldnrod_dg
DG's Type : RDF2
DG's Symmetrix ID : R1-SID (Microcode Version: 5773)
Remote Symmetrix ID : R2-SID (Microcode Version: 5773)
RDF (RA) Group Number : 2 (01)
 
Target (R2) View Source (R1) View MODES 
-------------------------------- ------------------------ ----- ------------
ST LI ST 
Standard A N A 
Logical T R1 Inv R2 Inv K T R1 Inv R2 Inv RDF Pair 
Device Dev E Tracks Tracks S Dev E Tracks Tracks MDAE STATE 
-------------------------------- -- ------------------------ ----- ------------
DEV001 0A7B WD 0 0 RW 071B RW 0 0 S... Synchronized
DEV002 0B03 WD 0 0 RW 0723 RW 0 0 S... Synchronized
DEV003 0B0B WD 0 0 RW 072B RW 0 0 S... Synchronized
DEV004 026B WD 0 0 RW 0733 RW 0 0 S... Synchronized
DEV005 0273 WD 0 0 RW 073B RW 0 0 S... Synchronized
Total -------- -------- -------- --------
Track(s) 0 0 0 0
MB(s) 0.0 0.0 0.0 0.0
Legend for MODES:
M(ode of Operation) : A = Async, S = Sync, E = Semi-sync, C = Adaptive Copy
D(omino) : X = Enabled, . = Disabled
A(daptive Copy) : D = Disk Mode, W = WP Mode, . = ACp off
(Consistency) E(xempt): X = Enabled, . = Disabled, M = Mixed, - = N/A
 
 
Symmetrix ID : R2-SID
Originator Port wwn : 10000000c9b21a36
User-generated Name : ldnrod/00
Sym Dev LUN
Name Dir:P Physical Device Name VBUS TID SYMM HOST Attr Cap(MB)
------ ----- ----------------------- ---- --- ---- ---- ---- -------
071B 3A:1 Not Visible 0 2 0 N/A (M) 136706 
 
Symmetrix ID : R2-SID
Host Name : ldnrod
Identifiers Found : 10000000c9b21a37
10000000c9b21a36
10000000c9b20ede
10000000c9b20edf
Device Cap(MB) Attr Dir:P
------ ------- ---- ----
071B 136706 (M) 3A:1,14A:1
0723 136706 (M) 3A:1,14A:1
072B 136706 (M) 3A:1,14A:1
0733 136706 (M) 3A:1,14A:1
073B 136706 (M) 3A:1,14A:1
-----------------------------
MB Total: 683530
GB Total: 667.5
 

But Iam getting the out-put like below loop not getting ended.

Device Group (DG) Name : ldnrod_dg
DG's Type : RDF2
DG's Symmetrix ID : R1-SID (Microcode Version: 5773)
Remote Symmetrix ID : R2-SID (Microcode Version: 5773)
RDF (RA) Group Number : 2 (01)
 
Target (R2) View Source (R1) View MODES 
-------------------------------- ------------------------ ----- ------------
ST LI ST 
Standard A N A 
Logical T R1 Inv R2 Inv K T R1 Inv R2 Inv RDF Pair 
Device Dev E Tracks Tracks S Dev E Tracks Tracks MDAE STATE 
-------------------------------- -- ------------------------ ----- ------------
DEV001 0A7B WD 0 0 RW 071B RW 0 0 S... Synchronized
DEV002 0B03 WD 0 0 RW 0723 RW 0 0 S... Synchronized
DEV003 0B0B WD 0 0 RW 072B RW 0 0 S... Synchronized
DEV004 026B WD 0 0 RW 0733 RW 0 0 S... Synchronized
DEV005 0273 WD 0 0 RW 073B RW 0 0 S... Synchronized
Total -------- -------- -------- --------
Track(s) 0 0 0 0
MB(s) 0.0 0.0 0.0 0.0
Legend for MODES:
M(ode of Operation) : A = Async, S = Sync, E = Semi-sync, C = Adaptive Copy
D(omino) : X = Enabled, . = Disabled
A(daptive Copy) : D = Disk Mode, W = WP Mode, . = ACp off
(Consistency) E(xempt): X = Enabled, . = Disabled, M = Mixed, - = N/A
 
Device Group (DG) Name : ldnrod_dg
DG's Type : RDF2
DG's Symmetrix ID : R1-SID (Microcode Version: 5773)
Remote Symmetrix ID : R2-SID (Microcode Version: 5773)
RDF (RA) Group Number : 2 (01)
 
Target (R2) View Source (R1) View MODES 
-------------------------------- ------------------------ ----- ------------
ST LI ST 
Standard A N A 
Logical T R1 Inv R2 Inv K T R1 Inv R2 Inv RDF Pair 
Device Dev E Tracks Tracks S Dev E Tracks Tracks MDAE STATE 
-------------------------------- -- ------------------------ ----- ------------
DEV001 0A7B WD 0 0 RW 071B RW 0 0 S... Synchronized
DEV002 0B03 WD 0 0 RW 0723 RW 0 0 S... Synchronized
DEV003 0B0B WD 0 0 RW 072B RW 0 0 S... Synchronized
DEV004 026B WD 0 0 RW 0733 RW 0 0 S... Synchronized
DEV005 0273 WD 0 0 RW 073B RW 0 0 S... Synchronized
Total -------- -------- -------- --------
Track(s) 0 0 0 0
MB(s) 0.0 0.0 0.0 0.0
Legend for MODES:
M(ode of Operation) : A = Async, S = Sync, E = Semi-sync, C = Adaptive Copy
D(omino) : X = Enabled, . = Disabled
A(daptive Copy) : D = Disk Mode, W = WP Mode, . = ACp off
(Consistency) E(xempt): X = Enabled, . = Disabled, M = Mixed, - = N/A
 
Symmetrix ID : R2-SID
Originator Port wwn : 10000000c9b21a36
User-generated Name : ldnrod/00
Sym Dev LUN
Name Dir:P Physical Device Name VBUS TID SYMM HOST Attr Cap(MB)
------ ----- ----------------------- ---- --- ---- ---- ---- -------
071B 3A:1 Not Visible 0 2 0 N/A (M) 136706 
 
Symmetrix ID : R2-SID
Originator Port wwn : 10000000c9b21a36
User-generated Name : ldnrod/00
Sym Dev LUN
Name Dir:P Physical Device Name VBUS TID SYMM HOST Attr Cap(MB)
------ ----- ----------------------- ---- --- ---- ---- ---- -------
071B 3A:1 Not Visible 0 2 0 N/A (M) 136706 
 
Symmetrix ID : R2-SID
Originator Port wwn : 10000000c9b21a36
User-generated Name : ldnrod/00
Sym Dev LUN
Name Dir:P Physical Device Name VBUS TID SYMM HOST Attr Cap(MB)
------ ----- ----------------------- ---- --- ---- ---- ---- -------
071B 3A:1 Not Visible 0 2 0 N/A (M) 136706 
 
Symmetrix ID : R2-SID
Originator Port wwn : 10000000c9b21a36
User-generated Name : ldnrod/00
Sym Dev LUN
Name Dir:P Physical Device Name VBUS TID SYMM HOST Attr Cap(MB)
------ ----- ----------------------- ---- --- ---- ---- ---- -------
071B 3A:1 Not Visible 0 2 0 N/A (M) 136706 

Did you try to indent your code at first ?

Sorry i dont know how to do

indent your code at first ?

You do it manually, when you originally code it - so it is easier to find where one loop ends and the other begins. It is also much less of a headache for others trying to understand your code.

In other words it is a good programming practice. Coming to your code, whats the "done" at the last line doing there? I cannot find a corresponding "do" anywhere above it.

To illustrate, if we use indenting, like ctsgnb and jawsnn suggest, we get this:

for f in `cat rdf2-dg.txt`
do
  symrdf -g $f query >> /home/srdf-query-report.txt
done
cat /home/srdf-query-report.txt|grep -i "Remote Symmetrix ID"|awk '{print $5}'> /home/sid.txt
cat /home/srdf-query-report.txt|grep -i "DEV001"|awk '{print $7}' > /home/dev.txt
for g in `cat /home/sid.txt`
do
  for h in `cat /home/dev.txt`
  do
    symmaskdb -sid $g -dev $h list assign |grep FA |head -1|awk '{print $2}' > tt1.txt
  done
done
for i in `cat tt1.txt`
do
  symmaskdb -sid $g -wwn $i list devs >> /home/srdf-query-report.txt
  symmaskdb -sid $g -wwn $i list devs|grep "User-generated Name"|awk '{print $4}'|sed "s/[/][0-9]*//" >tt2.txt
done
for j in `cat tt2.txt`
do
  for k in `cat /home/sid.txt`
    symmaskdb -sid $k -host $j list capacity >> /home/srdf-query-report.txt
  done
done

It then becomes immediately clear where there is a "do" missing..

Look at the video and use code NOT quote
Thanks