![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| combine 2 lines | Deanne | Shell Programming and Scripting | 0 | 10-24-2007 03:08 AM |
| Combine two lines | superprg | UNIX for Dummies Questions & Answers | 10 | 02-01-2006 08:47 AM |
| SImple HELP! how to combine two lines together using sed or awk.. | forevercalz | UNIX for Dummies Questions & Answers | 10 | 09-29-2005 06:33 AM |
| Combine two lines | wolf | UNIX for Advanced & Expert Users | 7 | 11-15-2002 12:14 PM |
| combine 2 lines (command & echo) | primal | UNIX for Dummies Questions & Answers | 13 | 10-09-2001 06:51 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Code:
#!/opt/third-party/bin/perl
my %fileHash;
my @arr;
open(FILE, "<", "a") || die "Unable to open file 'a'<$!>\n";
while(<FILE>) {
chomp;
@arr = split(/ /);
for(my $i = 1; $i <= ($#arr + 1); $i++ ) {
$fileHash{$arr[0]} .= " $arr[$i]";
}
}
close(FILE);
foreach my $key ( sort keys %fileHash ) {
print "$key ==> $fileHash{$key}\n";
}
exit 0
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|