Jim:
How about a Perl solution?
I'm sure a Perl Guru could do it in one line but it works on a file
created on a Linux box.
If the original data was created on a Windoze box you may need to deal
with other end of line issues. Also, if there are stray spaces laying
around that may cause grief -
Hope it works!
No warranty - implicit or implied!
Michael
concat4lines.pl
=================================
#!/usr/bin/perl -w
#
# Author: Michael W Folsom
#
# April 8, 2007
#
# USAGE: ./concat4lines.pl input_file_name
#
#
open(FILE, $ARGV[0]);
$NewStr ="";
$i = 0;
while (<FILE>) {
# assign the contents of the current line in the file
# to the built in variable $_
chomp($_);
if($i < 4) {
#print $_;
$NewStr = $NewStr . $_;
$i++;
if($i < 4) {
#print "\t";
$NewStr = $NewStr . "\t";
}
else {
print "$NewStr \n";
#$NewStr = $NewStr . "\n";
$i= 0;
$NewStr = "";
}
}
}
# if number of lines not equal to 4 then print out left overs
if($NewStr) {
print "$NewStr\n";
}
close(FILE);
exit();
=====================================================
On 4/8/07, James Hatridge <[EMAIL PROTECTED]> wrote:
Hi all,,
I'm not sure if this is a grep or awk question. I have a file with many
records of 4 lines each in it. Like this:
1
2
3
4
1
2
3
4
etc, etc
I need the file to look like this:
1 tab 2 tab 3 tab 4
1 tab 2 tab 3 tab 4
etc etc....
How can I do this?
Thanks,
JIM
--
Jim Hatridge
Linux User #88484
Ebay ID: WartHogBulletin
------------------------------------------------------
WartHog Bulletin
Info about new German Stamps
http://www.WartHogBulletin.de
Many Enemies -- Much Honor!
Anti-US Propaganda stamp collection
http://www.manyenemies-muchhonor.info
An American in Bavaria
http://www.gaubodengalerie.de
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]