Answer for this sed question ??
+2
Christopher
anand
6 posters
Page 2 of 2 • 1, 2
Re: Answer for this sed question ??
hey.. read my post completely.. am not giving any solution.. very confused...
Re: Answer for this sed question ??
hey.. finally got the answer. it search for pattern with 2 characters(one from "father" and one from "baby").
in ur example, u dont have any pattern like that. but look at my first example. it contains "table". t from "father" a from "baby" or a from "father" b from "baby".
in ur example, u dont have any pattern like that. but look at my first example. it contains "table". t from "father" a from "baby" or a from "father" b from "baby".
Re: Answer for this sed question ??
hey guess patterns are taken from both first and second keywords specified in brackets...
in my previous post
ciTe and mAke -->TAble
faTher and bAby-->TAble
faTher and Taxi-->boTTle
faTher and tAxi-->TAble
does it make sense
in my previous post
ciTe and mAke -->TAble
faTher and bAby-->TAble
faTher and Taxi-->boTTle
faTher and tAxi-->TAble
does it make sense
akalya- Posts : 70
Points : 86
Join date : 2010-03-04
Re: Answer for this sed question ??
Sorry.. characters need to be consecutive.
Last edited by Christopher on Tue Mar 09, 2010 8:45 pm; edited 2 times in total (Reason for editing : took wrong example)
Re: Answer for this sed question ??
Guys I didn't get your point..
So can you explain that using the following example,??
[335786@oracleclient ~]$ cat text
father pink powder
pink box table
colour colour colour
jottle jaby pink
father pink hello
pink pink lingavelu
[335786@oracleclient ~]$ sed '/[father][jottle]/s/pink/blue/g' text
father blue powder
pink box table
colour colour colour
jottle jaby blue
father blue hello
blue blue lingavelu
The Last line especially.....
So can you explain that using the following example,??
[335786@oracleclient ~]$ cat text
father pink powder
pink box table
colour colour colour
jottle jaby pink
father pink hello
pink pink lingavelu
[335786@oracleclient ~]$ sed '/[father][jottle]/s/pink/blue/g' text
father blue powder
pink box table
colour colour colour
jottle jaby blue
father blue hello
blue blue lingavelu
The Last line especially.....
Mahee- Posts : 29
Points : 233
Join date : 2010-03-03
Location : Haldia
Re: Answer for this sed question ??
@christopher
i can't get watever u say....
but guess consecutive things is considered
[335802@oracleclient ~]$ sed '/[cite][owle]/s/pink/blue/g' 2.txt
father pink powder
pink box table...........///DOESN'T REPLACE THOU ciTe and owLe -->TabLe
colour colour colour
blue bottle baby
pink father baby
pink pink pink
[335802@oracleclient ~]$ sed '/[cite][owla]/s/pink/blue/g' 2.txt
father pink powder
blue box table ................ ///here it is replaced ciTe and owlA-->TAble
colour colour colour
blue bottle baby
pink father baby
pink pink pink
@ mahee
father pink powder
pink box table
colour colour colour
jottle jaby pink
father pink hello
pink pink lingavelu.........////here E from fathEr and L from jottLe form a pattern which is matched to EL in lingavELu
so pink is replaced with blue...
i can't get watever u say....
but guess consecutive things is considered
[335802@oracleclient ~]$ sed '/[cite][owle]/s/pink/blue/g' 2.txt
father pink powder
pink box table...........///DOESN'T REPLACE THOU ciTe and owLe -->TabLe
colour colour colour
blue bottle baby
pink father baby
pink pink pink
[335802@oracleclient ~]$ sed '/[cite][owla]/s/pink/blue/g' 2.txt
father pink powder
blue box table ................ ///here it is replaced ciTe and owlA-->TAble
colour colour colour
blue bottle baby
pink father baby
pink pink pink
@ mahee
father pink powder
pink box table
colour colour colour
jottle jaby pink
father pink hello
pink pink lingavelu.........////here E from fathEr and L from jottLe form a pattern which is matched to EL in lingavELu
so pink is replaced with blue...
akalya- Posts : 70
Points : 86
Join date : 2010-03-04
Re: Answer for this sed question ??
Is the Formation of Pattern is by respective index of the strings, or all the possible combinations are considered as search patterns???
Mahee- Posts : 29
Points : 233
Join date : 2010-03-03
Location : Haldia
Re: Answer for this sed question ??
all combinations are considered as search pattern. only condition is one character from 1st string(it can be any character, irrespective of index position) and the next character should be from 2nd string.
Mahee- Posts : 29
Points : 233
Join date : 2010-03-03
Location : Haldia
Re: Answer for this sed question ??
thanks guys..
but is there a way to match multiple patterns without using "sed -e"????
but is there a way to match multiple patterns without using "sed -e"????
anand- Posts : 55
Points : 70
Join date : 2010-02-26
Age : 36
Re: Answer for this sed question ??
i don think so... tatsy we have '-e' switch... but its my assumption.. not sure...
Re: Answer for this sed question ??
cat 1.txt
The baby is pink.
baby wears pink dress.
Pink is its fav color.
father gets baby pink dress.
baby father cos he gets pink dress.
father s happy with pink.
hey elr is as good as pink.
sed '/[father][baby]/s/pink/blue/g' 1.txt
The baby is blue.
baby wears blue dress.
Pink is its fav color.
father gets baby blue dress.
baby father cos he gets blue dress.
father s happy with blue.
hey elr is as good as blue.
WHAT ABT THE LAST LINE????
It is replacing the pink with blue???? the pattern 'elr' has no consec alphabets plus both from 'father' only!!
Am confused!!!
The baby is pink.
baby wears pink dress.
Pink is its fav color.
father gets baby pink dress.
baby father cos he gets pink dress.
father s happy with pink.
hey elr is as good as pink.
sed '/[father][baby]/s/pink/blue/g' 1.txt
The baby is blue.
baby wears blue dress.
Pink is its fav color.
father gets baby blue dress.
baby father cos he gets blue dress.
father s happy with blue.
hey elr is as good as blue.
WHAT ABT THE LAST LINE????
It is replacing the pink with blue???? the pattern 'elr' has no consec alphabets plus both from 'father' only!!
Am confused!!!
Saradha Kannan- Posts : 25
Points : 25
Join date : 2010-03-04
Re: Answer for this sed question ??
@saradha
what abt ey in hey
e--->father
y---->baby
what abt ey in hey
e--->father
y---->baby
akalya- Posts : 70
Points : 86
Join date : 2010-03-04
Re: Answer for this sed question ??
oh thanks
Saradha Kannan- Posts : 25
Points : 25
Join date : 2010-03-04
Page 2 of 2 • 1, 2
Permissions in this forum:
You cannot reply to topics in this forum
|
|