Search

Top Posts

Comments

  • David: unfortunately this photo has either been doctored or is a complete fake. hopefully its the former 6 monitors...
  • slatapolsky: I should have updated this earlier, but I went ahead and upgraded from our old Netgear router (G) to a...
  • Cory: @Dave: It looks like 3rd party developers have access to this functionality, but not all use it. For example, I...
  • ZAYIFLAMA YOLLARI: Zayıflama Yolları, diyet listesi,rejim
  • Dan: You’d definitely need a microphone, mic stand and usb audio interface for a start!

Categories

Recent Posts


Open a text file to a specific line number

John Talbot writes in with this useful terminal tip: “I spend a lot of time writing scripts and editing text through the terminal, so if I get a script error telling me that line 240 is messed up, I use the following command to quickly access the problematic line: nano +240 script.sh” I found this to be a really useful command, if you’re unclear of the syntax it’s simple: nano +linenumber filename

Posted by: David Mendez

Share

Save big on Mac Deals from Amazon.com

Comments:

Comments: 5

Comment from talentpoolz
Time: May 28, 2007, 1:10 am

hey that’s actually pretty useful for command line tools like nano, but is there a way to do it with a gui editor? I doubt it, but then again you can just easily skip to a line in things like TextWrangler

Comment from dbr
Time: May 28, 2007, 7:09 am

In vim, the command is :
:[line number]

So to go to line 240 would be :240

Comment from Mike
Time: May 28, 2007, 2:56 pm

talentpoolz:
bbedit supports the same syntax “bbedit +240 script.sh”

Comment from Tony Williams
Time: May 29, 2007, 7:08 pm

While dbr is right that inside vim you would type “:240″ you can also use exactly the same command with vim as nano so “vi +240 script.sh” works from the command line.

On a historic note, this was added to vi so you could jump to a line mentioned in an error message from the C compiler and command line IDEs used it extensively.

Comment from generic
Time: June 16, 2008, 3:13 pm

found this to be a really useful

Write a comment






May 28th, 2007