cut

Shell Script: Read line in file

删除回忆录丶 提交于 2019-12-24 05:03:03
问题 I have a file paths.txt : /my/path/Origin/.:your/path/Destiny/. /my/path/Origin2/.:your/path/Destiny2/. /... /... I need a Script CopyPaste.sh using file paths.txt to copy all files in OriginX to DestinyX Something like that: #!/bin/sh while read line do var= $line | cut --d=":" -f1 car= $line | cut --d=":" -f2 cp -r var car done < "paths.txt" 回答1: Use translate : tr command & apply cp command in the same go! #!/bin/sh while read line; do cp `echo $line | tr ':' ' '` done < "paths.txt" 回答2:

How to keep only certain numbers in a giant number in bash?

本小妞迷上赌 提交于 2019-12-24 03:23:09
问题 I have a huge file that contains genotypes. Basically, one line is a loci (or a SNP) and a column (all the numbers are concatenated together to form one giant number, but one number align in one column is 1 individual. In this example I have 96 number in a row so 96 individuals). Here is an example: 921212922222222212292222229222221222211222222222222219929222292222922229919922222222222222292292 929111221111111221191211222912222221111210229921222129929222291221921219929992122122222211292299

Extract specific strings from line in file and output to another file with modifications

笑着哭i 提交于 2019-12-23 16:42:53
问题 New to linux and trying to escape doing this the hard way. I have a file ("output.txt") that contains the results of a 'find' command. Example first three lines from "output.txt": /home/user/temp/LT50150292009260GNC01/L5015029_02920090917_MTL.txt /home/user/temp/LT50150292009276GNC01/L5015029_02920091003_MTL.txt /home/user/temp/LT50150292009292GNC01/L5015029_02920091019_MTL.txt I'd like to use awk or sed (or similar) to extract two parts from the path listed for each line, and output to a new

How to find/cut for only the filename from an output of ls -lrt in Perl

。_饼干妹妹 提交于 2019-12-23 06:16:18
问题 I want the file name from the output of ls -lrt , but I am unable to find a file name. I used the command below, but it doesn't work. $cmd=' -rw-r--r-- 1 admin u19530 3506 Aug 7 03:34 sla.20120807033424.log'; my $result=`cut -d, -f9 $cmd`; print "The file name is $result\n"; The result is blank. I need the file name as sla.20120807033424.log So far, I have tried the below code, and it works for the filename. Code #!/usr/bin/perl my $dir = <dir path>; opendir (my $DH, $dir) or die "Error

How to find/cut for only the filename from an output of ls -lrt in Perl

心已入冬 提交于 2019-12-23 06:15:45
问题 I want the file name from the output of ls -lrt , but I am unable to find a file name. I used the command below, but it doesn't work. $cmd=' -rw-r--r-- 1 admin u19530 3506 Aug 7 03:34 sla.20120807033424.log'; my $result=`cut -d, -f9 $cmd`; print "The file name is $result\n"; The result is blank. I need the file name as sla.20120807033424.log So far, I have tried the below code, and it works for the filename. Code #!/usr/bin/perl my $dir = <dir path>; opendir (my $DH, $dir) or die "Error

How to group Time Series data into round intervals of 5 minutes in R?

≯℡__Kan透↙ 提交于 2019-12-23 05:07:49
问题 I have a time series data frame looking like this: Time Source Value 1 2016-01-20 15:10:04 C04 OPEN 2 2016-01-20 15:09:57 M04 true 3 2016-01-20 15:09:53 M02 true 4 2016-01-20 15:09:53 M03 true 5 2016-01-20 14:44:54 M04 true now I would like to group them in intervals of 5 minutes starting from 00:00:00, so that I get intervals of 0-5-10-15-20... and so on. The intervals shall be used later as a group identifier: Time Source Value Group 1 2016-01-20 15:10:04 C04 OPEN 10 2 2016-01-20 15:09:57

How to cut a number in different bin and expand the data frame with the new bins?

£可爱£侵袭症+ 提交于 2019-12-23 04:55:10
问题 I would like to compute something really simple, but I don't find the solution. I want to cut in bins certain numbers, but I want to save the bins. bin.size = 100 df = data.frame(x =c(300,400), y = c("sca1","sca2")) cut(df$x, seq(0, 400, bin.size), include.lowest = TRUE) Gives me [1] (200,300] (300,400] Levels: [0,100] (100,200] (200,300] (300,400] But what I want something like this: bin y 1 (0,100] sca1 2 (100,200] sca1 3 (200,300] sca1 4 (0,100] sca2 5 (100,200] sca2 6 (200,300] sca2 7

How to use MS-DOS Commands to cut paper using ESC/POS commands?

人盡茶涼 提交于 2019-12-23 02:53:09
问题 I have a simple requirement of printing text files from Windows (MS-Dos). Let's assume that my normal text file resides on "C:\Temp" folder. On the other hand, I have a EPSON TM88V receipt printer. I am able to shake hand with receipt printer connected on USB and able to print it with below command: C:\Temp> PRINT /D:\WORKSTATION\EPSONTM-T88V C:\Temp\HelloWorld.txt Though it's printing; but it's not cutting the paper. I need to insert those ESC/POS commands in my text file and pass it on to

How to use MS-DOS Commands to cut paper using ESC/POS commands?

我们两清 提交于 2019-12-23 02:53:06
问题 I have a simple requirement of printing text files from Windows (MS-Dos). Let's assume that my normal text file resides on "C:\Temp" folder. On the other hand, I have a EPSON TM88V receipt printer. I am able to shake hand with receipt printer connected on USB and able to print it with below command: C:\Temp> PRINT /D:\WORKSTATION\EPSONTM-T88V C:\Temp\HelloWorld.txt Though it's printing; but it's not cutting the paper. I need to insert those ESC/POS commands in my text file and pass it on to

Cut video with ffmpeg.

懵懂的女人 提交于 2019-12-23 02:34:57
问题 This is my idea. I want to cut the first 10s of video and the last 10s of video Thank for help 回答1: With re-encoding: ffmpeg -ss 10 -i video.mp4 -filter_complex "[0]trim=10,setpts=PTS-STARTPTS[b];[b][0]overlay=shortest=1" -shortest -c:a copy out.mp4 -ss 10 sets the the amount to cut from beginning. trim=10 sets amount to cut from end. Caveat here is that due to a current bug with shortest=1 , this may not work on ffmpeg builds from 2017. A bit of a hack method, which skips transcoding: ffmpeg