Discussion:
replace string
Lis Maria
2013-09-26 05:25:33 UTC
Permalink
Lis Maria
2013-09-30 03:03:45 UTC
Permalink
Hi,


Any pointers?


Thanks,
Lis
Hi,
I have a file and in that a line as below
command:mkdir -type -type_tag <this could be anything> -yes -noadmin
I want to replace <this could be anything> with some other string.
How can i do this? tried couple of sed command. but not able to get
through.
Thanks,
Lis
satish
2013-10-03 10:20:32 UTC
Permalink
Hi Maria,


Try this command


sed '/*command\:mkdir -type -type_tag*/s/string1/string2/g' filename >
output_file


Regards,
Satish Kumar


*-Regards,*
* Satish*
Post by Lis Maria
Hi,
Any pointers?
Thanks,
Lis
Hi,
I have a file and in that a line as below
command:mkdir -type -type_tag <this could be anything> -yes -noadmin
I want to replace <this could be anything> with some other string.
How can i do this? tried couple of sed command. but not able to get
through.
Thanks,
Lis
Davide Brini
2013-10-03 09:47:57 UTC
Permalink
I have a file and in that a line as below
command:mkdir -type -type_tag -yes -noadmin
I want to replace with some other string.
How can i do this? tried couple of sed command. but not able to get
through.
What about

sed 's/command:mkdir -type -type_tag -yes -noadmin/some other string/' file

or

sed '/command:mkdir -type -type_tag -yes -noadmin/ c\
some other string' file
--
D.
Loading...