Nano, Thanks Tim-and-Dave

Tim Chase blinux.list at thechases.com
Wed Apr 19 18:50:03 UTC 2006


> Now, if a standard keyboard only goes up to f12, how can I push f14?

You can't.  However, if the application provides alternative 
key-bindings, you can use them.  As, in this case, you can 
with nano.  Nano also provide control+backslash, alt+R, and 
pressing escape followed by pressing "R" as alternatives to F14.

> Next, you say I can type control k, but then control u.  Will it prompt 
> me for which file I want to move text in to?

No, but that's where that escape-comma and escape-period 
come into play.  They navigate forward and backwards in the 
list of file arguments.  At the top of your screen it will 
read "File: file1.txt".  When you press escape followed by 
greater-than (or period), it will go to the next buffer 
argument, making the top line read "File: file2.txt". 
They're basically "next file" and "previous file" commands.

> Lastly, while in nano, if I want to globally get rid of all blank lines, 
> how would I do this?  I remember in wp6.0 there were ways to get rid of 
> all "hrt"

I'm not sure nano provides an easy way to do this.  however, 
there are plenty of shell utilities that will do what you 
want.  If you want to compress multiple blank lines into a 
single blank line, you can use

	cat -s file.txt > file_one_space.txt

If you don't want *any* blank lines in your file, you can use

	sed -ni '/./p' file.txt

(to modify the file in place) or

	sed -n '/./p' file.txt > file_no_space.txt

to put the results in a file named file_no_space.txt

That second one can also be done with grep:

	grep '.' file.txt > file_no_space.txt

If you want to remove all carriage returns in your file, you 
can do that with tr

	tr -d '\012' < file.txt > file_no_cr.txt

though that can yield some ugly results...you might prefer

	tr '\012' ' ' < file.txt > file_no_cr.txt

With vim, you can do some trickier manipulations, like

	:g/./norm vipJ

which will paragraphify your document nicely.  However, such 
stunts require a slightly smarter editor than nano.

-tim







More information about the Blinux-list mailing list