Re: File Manipulation in Linux
- From: Marc Schwartz <marc_schwartz@xxxxxxxxxxx>
- Date: Sat, 27 Jan 2007 19:38:38 -0600
tman wrote:
I want to search a text file for certain words and pipe them to another file, each word on a seperate line. Here is an example:
File1.txt
index: A name_110022763763
index: A name_110022028309
index: A name_110022162534
I want to search File1.txt for all the name_xxxxxxxxxxxx words and pipe them to another file each word on a seperate line. The other file would look like this:
File2.txt
name_110022763763
name_110022028309
name_110022162534
Does anyone know how to do this?
Thanks
This should work:
$ cat File1.txt
index: A name_110022763763
index: A name_110022028309
index: A name_110022162534
$ grep -o "name.*" File1.txt > File2.txt
$ cat File2.txt
name_110022763763
name_110022028309
name_110022162534
See 'man grep' for further help.
HTH,
Marc Schwartz
.
- Follow-Ups:
- Re: File Manipulation in Linux
- From: Marc Schwartz
- Re: File Manipulation in Linux
- References:
- File Manipulation in Linux
- From: tman
- File Manipulation in Linux
- Prev by Date: File Manipulation in Linux
- Next by Date: Re: File Manipulation in Linux
- Previous by thread: File Manipulation in Linux
- Next by thread: Re: File Manipulation in Linux
- Index(es):
Relevant Pages
|