[Techtalk] VI(M) - Changing & Merging 2 lines?

Luke Woods lwoods at netstarnetworks.com
Tue Sep 2 02:34:48 EST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

 perl -e '$x=0; while(<>) { if($x==0) { chomp($line1 = $_); print
"$line1,"; $x++ } elsif($x==1) { chomp($line2=$_); print "$line2\n";
$x-- } }' < source_file

Should work :P

- -----Original Message-----
From: techtalk-bounces at linuxchix.org
[mailto:techtalk-bounces at linuxchix.org] On Behalf Of Subba Rao
Sent: Tuesday, 2 September 2003 1:29 AM
To: Linux Ladies
Subject: [Techtalk] VI(M) - Changing & Merging 2 lines?



Hello,

I have a large text file where 2 lines (fields) form a record.  Now I
want 
to merge the 2 lines into one line seperated by a comma.

Line1
Line2

The fields should be seperated by a comma.

Line1,Line2

How can I define a keystroke that will,
    	add a comma at the end of Line1
    	perform a JOIN of Line1 and Line2
    	move the cursor to the next record?

Any help appreciated.

Thank you in advance.


-----BEGIN PGP SIGNATURE-----

iQA/AwUBP1N092ICfwSPzc3xEQKRlwCgwuYKOFFkcRovRvj6w5pRA234S0MAoLcQ
L8tqE0tKBAqNtl8Hxh1RCKg7
=djyj
-----END PGP SIGNATURE-----



More information about the Techtalk mailing list