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

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:

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

my email address is :

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


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

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


Jim Abbey

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

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

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

                Brian Graham

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

Try "sed ' < srcfile"

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

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 -



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