LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-02-2009, 08:07 AM   #1
DoME69
Member
 
Registered: Jan 2008
Posts: 189

Rep: Reputation: 16
Open gvim viewer only from line X to Y?


Hi...

I have the following file:


Quote:
### kuku

bla
bla
bla
bla

### kuku2
alb
kuku
alb


### k3

kuku2
lab
lab
###
While greping the word kuku2
i want gvim / nedit open the same section

example:

source ./file.c kuku2

gvim display:

Quote:
### kuku2
alb
kuku
alb

### k3

kuku2
lab
lab
hope i clarify my self

Last edited by DoME69; 12-02-2009 at 08:12 AM.
 
Old 12-02-2009, 05:34 PM   #2
rsashok
Member
 
Registered: Nov 2006
Location: USA, CA
Distribution: RedHat, Debian
Posts: 202

Rep: Reputation: 31
One way:
Quote:
vi +`grep -n kuku2 file.c | cut -f 1 -d':'` file.c
vi +line_number file.c - opens file at 'line_numeber'
grep -n kuku2 filec - outputs line_number in the first column
cut -f 1 -d':' - cuts out the first column delimited by ':'

I don't how it behaves if there are two lines with "kuku2".
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Command line picture viewer Rostfrei Linux - Software 5 07-14-2016 03:41 AM
I need a command line image viewer/manager... branvu Linux - Software 1 02-25-2006 05:03 AM
does anyone know how to enable line completions in vim or gvim Joseph Schiller Linux - Software 2 10-31-2005 09:11 PM
Mandrake 10.x - Gvim 'split open' corrupts opened files and leaves ghost swapfiles Xolo Linux - Software 0 05-23-2005 05:24 AM
macos-like command line file viewer (open) in linux shunker Linux - Newbie 0 12-25-2003 07:21 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:04 PM.

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