Need to remove a character using sed


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 1  
Bug Need to remove a character using sed

Hi All,

I have output like this below
Code:
ldprod/03
ldprod/02
ldprod/01
ldprod/00
ldnprod/
ldnprod/030

I want only remove all character including /
Code:
ldprod
ldprod
ldprod
ldprod
ldprod
ldnprod

ldnprod


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

Last edited by vbe; 06-20-2012 at 10:44 AM..
# 2  
You have finished in mod queue for you used fancy fonts...
# 3  
Code:
sed 's:/.*::' yourfile

# 4  
Bug

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.


Code:
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

Code:
Device Group (DG) Name : ldnrod_dg

Code:
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.
Code:
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 


Last edited by vbe; 06-20-2012 at 12:33 PM..
# 5  
Did you try to indent your code at first ?
# 6  
Sorry i dont know how to do
Code:
indent your code at first ?


Last edited by vbe; 06-20-2012 at 12:28 PM.. Reason: replace quote by code...
# 7  
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.
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Science: Computers
Difficulty: Medium
It's not possible to format a write-protected DVD-R Hard Disk.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to remove first and last character using sed

Hi I have file in below format. How i can remove the first and lost comma from this below file ,001E:001F,,,02EE,0FED:0FEF, I need output has below 001E:001F,,,02EE,0FED:0FEF (6 Replies)
Discussion started by: ranjancom2000
6 Replies

2. Shell Programming and Scripting

How to remove newline character if it is the only character in the entire file.?

I have a file which comes every day and the file data look's as below. Vi abc.txt a|b|c|d\n a|g|h|j\n Some times we receive the file with only a new line character in the file like vi abc.txt \n (8 Replies)
Discussion started by: rak Kundra
8 Replies

3. Shell Programming and Scripting

sed - remove begin of line up to the third and including occurence of character

hello. How to remove all characters in a line from first character ( a $ ) until and including the third occurrence of that character ( $ ). Any help is welcome. (10 Replies)
Discussion started by: jcdole
10 Replies

4. Shell Programming and Scripting

Remove last occurrence of character (_) and rest of the string in UNIX (sed)

Hi I need help on this ..!! Input : xx_abc_regA xx_def_regB xx_qwe_regC Now i required the output as the below abc def qwe Need to remove last occurrence of character (_) and rest of the string in Unix (sed). Thanks in Advance ..!!! -Nallachand (3 Replies)
Discussion started by: Nallachand
3 Replies

5. Shell Programming and Scripting

Want to remove / and character using awk or sed

Below i am trying to remove "/" and "r" from the output, so i need output as: hdiskpower3 hdisk0 hdisk1 #inq | grep 5773 | awk '{print $1}' | sed 's/dev//g' | awk -F"/" '{$1=$1}1' .....................................................//rhdiskpower0 //rhdiskpower1 //rhdiskpower2... (3 Replies)
Discussion started by: aix_admin_007
3 Replies

6. Shell Programming and Scripting

any savant ? using AWK/SED to remove newline character between two strings : conditional removal

I'd like to remove (do a pattern or precise replacement - this I can handle in SED using Regex ) ---AFTER THE 1ST Occurrence ( i.e. on the 2nd occurrence - from the 2nd to fourth occurance ) of a specific string : type 1 -- After the 1st occurrence of 1 string1 till the 1st occurrence of... (4 Replies)
Discussion started by: sieger007
4 Replies

7. Shell Programming and Scripting

Sed is doing my head in! How do you remove the first character of a string?

Hello! Please bare with me, I'm a total newbie to scripting. Here's the sudo code of what I'm trying to do: Get file name Does file exist? If true get length of file name get network id (this will be the last 3 numbers of the file name) loop x 2 If... (1 Reply)
Discussion started by: KatieV
1 Replies

8. Shell Programming and Scripting

How to remove space in sed for / character

Hi... i need a script to remove the space before and after the operator like( / ). Ex : Input file apple / manago mango / fresh apple / fresh Desired output: apple/manago mango/fresh apple/fresh Note: betwee the desired operator space should be removed, between words do not remove... (3 Replies)
Discussion started by: vasanth_vadalur
3 Replies

9. Shell Programming and Scripting

sed: remove first character from particular line

Hello Experts, I have a file "tt.txt" which is like: #a1=a2 b1=b2 #c1=c2 I need to remove the pound (#) sign from a particular line. In this case let us assume it's 3rd line : "#c1=c2" I can do it through: sed "s/#c1=c2/c1=c2/" tt.txtbut it is possible that I may not know the value... (6 Replies)
Discussion started by: hkansal
6 Replies

10. Shell Programming and Scripting

sed to remove character ['

I have a huge file where the each column has data in the format: . I want to remove the from each value. How do I do it with sed? thanks (2 Replies)
Discussion started by: manishabh
2 Replies

Featured Tech Videos