Help with "grep"

Help with "grep"

Post by Mark Gilber » Sun, 15 Apr 2001 05:55:45



Greetings,
I have 300 files in a solaris directory, and I need to extract two
pieces of info from each file.
Example:

Name
IP address

A file might contain more than one IP address,  I need to have the
name associated with each IP address.
All of this needs to be output to a file.

Thanks for your time.
Regards,

 
 
 

Help with "grep"

Post by Bill Marcu » Tue, 17 Apr 2001 06:22:27



>Greetings,
>I have 300 files in a solaris directory, and I need to extract two
>pieces of info from each file.
>Example:

>Name
>IP address

>A file might contain more than one IP address,  I need to have the
>name associated with each IP address.
>All of this needs to be output to a file.

And what else might these files contain other than IP addresses?
Could there be anything else on the same line with the IP address?
By "name", do you mean the filename or a name stored in the file?

 
 
 

Help with "grep"

Post by Dave Granti » Tue, 17 Apr 2001 13:06:55


A snippet of the relevant file would be most helpful.



> Greetings,
> I have 300 files in a solaris directory, and I need to extract two
> pieces of info from each file.
> Example:

> Name
> IP address

> A file might contain more than one IP address,  I need to have the
> name associated with each IP address.
> All of this needs to be output to a file.

> Thanks for your time.
> Regards,


Dave

+---------------------+---------------+


+---------------------+---------------+

 
 
 

1. Help with "grep" command

Greetings all,

Is there a command allowing to find a string in a file BUT STOPS AT
the first occurence of this string ?

To be more specific, here is my trouble : I am generating some big files
in which I would like to extract the line number (corresponding to a
given string). I use for this :

                            nl file | grep "string"

However, this string appears only once. This is why I would like
a command which does not perform the searching farther than the first
occurence.

I hope I was clear enough....

Thanks all.

--
*********************************************************
*  " Lorsque la chance s'envole,                        *
*               lorsque la raison decolle,              *
*                       il nous reste la picolle "      *
*********************************************************
*  Ahmed Bouferguene          *                         *
*  Department of Physics,     * Tel : 1 (904) 599 3896  *
*  Florida A & M University   * Fax : 1 (904) 599 3577  *
*  Tallahassee, FL32307.      *                         *
*********************************************************

2. Not able to boot Win98 ..

3. GETSERVBYNAME()????????????????????"""""""""""""

4. System.map(or similiar file) in Solaris?

5. """"""""My SoundBlast 16 pnp isn't up yet""""""""""""

6. network interface address

7. Can grep be made using "and" instead of "or"

8. Remove gpm from boot process

9. A tough one with "find" and "grep"

10. find /from -exec grep "string" {} ";"

11. Type "(", ")" and "{", "}" in X...

12. : how to "tail -f" together with "grep"

13. "umsdos" vs "vfat" vs "looped ext2"