It is currently Mon, 25 Sep 2023 10:57:22 GMT



 
Author Message
 grep problem

I need to modify one of my data files...

can any one tell my how i could insert a word in a string:

for example:  

I have a list file containing the following email addresses

pe...@new-york.abc.com
sa...@new-york.nbc.com

and son on..

I need to insert "nycsu2" between the symbol @ and new-york followed by
a dot (.)   giving me the final outcome as follows:

pe...@nycsu2.new-york.abc.com
sa...@nycsu2.new-york.nbc.com

can i do that using grep or awk or both..  any and all the help will be
greatly appreciated:

my email address is :

il...@nycsu2.new-york.sl.slb.com
or
il...@new-york.sl.slb.com
or
il...@ycvax.york.cuny.edu



 Mon, 26 Jul 1999 03:00:00 GMT   
 grep problem

Hi,

You will get about 20 different answers to this. Here's one...

sed -e 's/@/@nycsu2./' input-file >output-file

Regards,

Jim Abbey



 Tue, 27 Jul 1999 03:00:00 GMT   
 grep problem

#cat file | sed 's/new-york/nycsu2.new-york/g' > newfile

Then you can examine the newfile and if it is correct, copy it over
the original file.
--

                Brian Graham
                bri...@austin.ibm.com



 Tue, 27 Jul 1999 03:00:00 GMT   
 grep problem

Try "sed '...@new-york.abc.com/...@nycsu2.new-york.abc.com/ < srcfile"



 Sun, 01 Aug 1999 03:00:00 GMT   
 grep problem

OK.
First vi your file, when it opens press : to enter command mode.  The : prompt will appear in the bottom left hand corner of you screen.  Now
just type in the following  -

g/@/s//@nycsu2./g <RETURN>

Don't forget to save your changes -

:wq

Regards,

Mark Wright.



 Fri, 06 Aug 1999 03:00:00 GMT   
 
   [ 5 post ] 

Similar Threads

1. grep problem.

2. grep problems - strange

3. csh/grep problem (on Linux)

4. grep problem in ps aux

5. grep problem

6. Q: Bizarre grep problem

7. sed/grep problems

8. 2K grep problem

9. grep problem - need to extract a substring


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software