LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-18-2004, 08:52 AM   #1
mijohnst
Member
 
Registered: Nov 2003
Location: Huntsville, AL
Distribution: RHEL, Solaris, OSX, SuSE
Posts: 419

Rep: Reputation: 31
Parsing with Vim


I have a 50 meg text file that I'm going to have to fish through to find certain lines and I was wondering if it's possible to parse it with vi so that I don't have to look through ever line. It would be nice if vi would find the lines and them copy them to another file or just group them all together. Is this something even possible with vi?

Here is a simple example:

# textfile1.txt
granted
granted
granted
granted
granted
denied (I want this line moved to to textfile2.txt)
granted

# textfile2.txt
denied

If this isn't possible with Vim, I'd sure like some suggestions. Thanks!
 
Old 06-18-2004, 09:25 AM   #2
miss crump
LQ Newbie
 
Registered: May 2004
Location: Oklahoma City, OK
Distribution: Debian
Posts: 17

Rep: Reputation: 0
You could use grep to search the first file and then output the results to a second file. It would look something like this, depending on what you wanted to do:

grep "searchpattern" file1 > file2
 
Old 06-18-2004, 09:38 AM   #3
mijohnst
Member
 
Registered: Nov 2003
Location: Huntsville, AL
Distribution: RHEL, Solaris, OSX, SuSE
Posts: 419

Original Poster
Rep: Reputation: 31
miss crump, that's exactly what I'm looking for... Thank you so much...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
encryption with Vim (vim -x) mikshaw Linux - Software 2 03-07-2007 09:00 AM
Need help with file parsing BrianK Programming 2 09-02-2005 05:58 PM
Parsing. liguorir Programming 2 09-04-2003 04:56 PM
parsing a webpage help please mrtwice Programming 3 04-25-2003 12:25 PM
php not parsing chens_83 Linux - General 9 02-19-2003 04:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration