vi - joining consecutive lines
by ArfaSmif from LinuxQuestions.org on (#5SV30)
I map a key in vi to help me join two lines together and then move to the next line. Rinse and repeat. This is part of the process to help me shuffle some #EXTM3U style playlists for my portable music player.
I map the key [ to do the following:-
1. Go to the end of the line ($)
2. Join two lines together (J)
3. Down arrow key to go to next line.
Like this in vi:-
:map [ $J(CTRLV)(DOWN ARROW KEY)(PRESS RETURN KEY)
This works well except for the fact that some playlists may have 6000 lines in them. In which case, I sit there for a minute or so holding my finger down on the [ key.
My question is this. Is there a simple command in vi that I can use to achieve the same result? Or is there a more elegant way to do this, perhaps with sed or awk etc?
Thanks for your help.
I map the key [ to do the following:-
1. Go to the end of the line ($)
2. Join two lines together (J)
3. Down arrow key to go to next line.
Like this in vi:-
:map [ $J(CTRLV)(DOWN ARROW KEY)(PRESS RETURN KEY)
This works well except for the fact that some playlists may have 6000 lines in them. In which case, I sit there for a minute or so holding my finger down on the [ key.
My question is this. Is there a simple command in vi that I can use to achieve the same result? Or is there a more elegant way to do this, perhaps with sed or awk etc?
Thanks for your help.