The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 03-25-2008
raichlea raichlea is offline
Registered User
 

Join Date: Mar 2008
Posts: 11
Help with grep and regex

Hi all,

I'm a beginner with linux, regex, grep, etc
I am trying to get data out of a file that has about 13,000 lines in this format

name - location

I want to grep all the names out to one file and the locations to another so I can put them into a spreadsheet.

Some have hyphenated names or hyphenated locations as well to complicate things.

The way I was going to approach it was to first grep out the lines with only one hypen to one file and all the ones with multiple hyphens to another.

Then I need an expression to select all data on one side of the hyphen and place it into one file, and the data on the other side of the hyphen into another file.

I'm going through all the tutorials I can find, but they don't read much better than man pages and I can't figure out how to do what I want. Can anyone help me get started with this?


Thanks in advance!
Reply With Quote
Remove advertisements
!!
Forum Sponsor