如何使用粘贴粘贴两个不同文件的多个列?

时间:2016-05-29 00:24:01

标签: bash macos

使用此数据:

$cat file1
8.0     175.0
9.0     405.8
10.0    844.8
11.0    307.2

$cat file2
8.0     188.5
9.0     428.6
10.0    945.7
11.0    335.9

如何将这些合并到一起。我简单地尝试了paste的几种可能性:

$paste file1 file2

问题是我得到三列,其中中间的一列是从两个原始列合并而来的:

8.0     8.0.5   175.0
9.0     9.0.6   405.8
10.0    10.07   844.8
11.0    11.09   307.2

我想要的结果如下:

8.0     175.0    8.0    188.5
9.0     405.8    9.0    428.6
10.0    844.8    10.0   945.7
11.0    307.2    11.0   335.9

1 个答案:

答案 0 :(得分:2)

你的文件有\ r \ n行结尾,所以第一行实际上是:

dos2unix

在您的文件上运行sed -i.bak 's/\r$//'- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType]; if ([mediaType isEqualToString:@"public.movie"]){ NSLog(@"got a movie"); NSURL *videoURL = [info objectForKey:UIImagePickerControllerMediaURL]; NSData *data = [NSData dataWithContentsOfFile:videoURL]; NSMutableURLRequest *request =[[NSMutableURLRequest alloc] init]; [request setURL:[NSURL URLWithString:@"http://dotstudioservices.com/labajaService/Service1.svc/videoempresa"]]; [request addValue:@"video" forHTTPHeaderField: @"Content-Type"]; [request setHTTPMethod:@"POST"]; NSInputStream *inputStream = [[NSInputStream alloc] initWithFileAtPath:[videoURL path]]; [request setHTTPBodyStream:inputStream]; [NSURLConnection sendAsynchronousRequest:request queue:[[NSOperationQueue alloc] init] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) { if ([data length] >0 && error == nil) { NSLog(@"Request ended"); } else if ([data length] == 0 && error == nil) { NSLog(@"Nothing was downloaded."); } else if (error != nil){ NSLog(@"Error = %@", error); } }]; } [picker dismissViewControllerAnimated:YES completion:NULL]; }