Questions tagged [cut]

cut is a Unix command line utility which is used to extract sections from each line of input.

Filter by
Sorted by
Tagged with
0 votes
1 answer
24 views

Insert new line if file contain string

I need to insert 'import packagename' to the line after imports. In files which contains the specific word. What I try: find iOS/Chat \ -type f \ -name "*.swift" \ -exec gsed -e "/...
user avatar
  • 101
0 votes
0 answers
5 views

`ffmpeg.exe -i a.mp4 -ss 21 -c copy b.mp4` to cut video, images cut to much

I use command in title to cut video, images cut to much, when start play, the first image is maybe 3 seconds later. the first 3 seconds images stay static, but audio is ok. what's the reason of this, ...
user avatar
0 votes
0 answers
44 views

Remove a section of video with ffmpeg

I want to remove a short section in the middle of an mkv file and end up with the remainder as one single file (i.e., the section before the removed section concatenated wit the section after it.) I ...
user avatar
  • 1
0 votes
0 answers
62 views

FFMpeg - cutting video with hdmv_pgs_subtitle

Can I successfully trim a subtitle video in this format? I am getting errors like below and there are no subtitles in the output file (i.e. not showing up on playback)? Input #0, mpegts, from '...
user avatar
  • 1
0 votes
2 answers
48 views

Grep Sed with bash

I'm trying to achieve the following using bash and sed where the file containing below strings qa2.test.m.xyz.com 554 1723 21 qa88.test.nj.xyz.com 1723 554 21 443 80 qa2.lite.xyz.com 554 1723 21 ...
user avatar
  • 45
0 votes
1 answer
88 views

awk multiple commands and multiple args

I'm trying to turn this output: ❯ hg branches -T'{node} {branch}\n' 4b0826975cb29da26a6dd13f463241463c43c6a7 maria 5c31751cdb774f8b6337b6f64232b15903530997 default Into these commands: hg bookmark -r ...
user avatar
  • 11.4k
1 vote
0 answers
34 views

Removing multiple parts of a file name using cut

I have a bunch of files named like so: CI2_S1_20201120_S75_L001_R1_001.fastq.gz CI2_S2_20201120_S76_L001_R2_001.fastq.gz AV2_S2_20201120_S61_L001_R2_001.fastq.gz and I want to rename the files to ...
user avatar
  • 11
0 votes
3 answers
448 views

Can I simply cut and paste a program from C drive onto another partition and still be able to run the program?

I cut and pasted some programs from C drive to another partition to free up some space in the C drive. Now the programs don't run. Should I move the programs back to C drive again?
user avatar
  • 1
1 vote
1 answer
35 views

Shrink filename (remove last N columns)

I want to remove from this filename last 3 columns david@david-ThinkPad-E480:~/Downloads$ ll A* -rw-rw-r-- 1 david david 16006720 сен 9 11:03 'A.Matrosov. E.Rodionov. S.Bratus. Rootkits and Bootkits. ...
user avatar
  • 125
0 votes
1 answer
36 views

Sort lines in file by first field treated as number in shell

I have a file with the format shown below (a number + an IPv4 address). This format was generated by using uniq -c. I want to sort the lines after the first number in each of them. I would've gone for ...
user avatar
  • 139
2 votes
0 answers
54 views

Is it possible to find piece of audio inside of mp3 file?

We have a community radio and we are recording all shows 24/7. And we are wondering is there any way to automatically trim those recordings so that all commercials and unwanted parts are cutted off ...
user avatar
0 votes
1 answer
72 views

How to cut video resolution from 3840x2160 to 2184x1680 in VLC

So I have a video 3840x2160 resolution and I want to cut out a part of it. So I'd only have the upperleft 2184x1680 pixels. Can that be done in VLC?
user avatar
1 vote
1 answer
131 views

Cut out the start and end of a .mp4 file

I have been using ffmpeg to remove the first 5 seconds of a video clip with the following code. for %%a in ("*.mp4") do ffmpeg -i "%%a" -ss 05 -acodec copy -vcodec copy "newfiles\%%~na.mp4" pause Is ...
user avatar
0 votes
1 answer
2k views

Precisely cut videos with ffmpeg [duplicate]

I would like to cut videos using ffmpeg for machine learning. How can I ensure that if I cut (for example) 1s of video @25fps this will provide exactly 25 frames of synchronized audio and video? I ...
user avatar
1 vote
1 answer
5k views

Using 'cut' command on Windows

I am trying to run this command line on Windows (I've installed GNU coreutils 8.24) echo android:versionCode="3267" | cut -d \" -f 2 Expected output: 3267 However, I am getting error: cut: the ...
user avatar
  • 133
1 vote
1 answer
61 views

How to extract all strings in require('')?

My source files are something like this: abl require('../img/a.png') require('../img/b.png') bla require('../../img/c.png') ble <Image source={require('../img/d.png')} My expected output is: '../...
user avatar
  • 113
0 votes
0 answers
1k views

cut: you must specify a list of bytes, characters, or fields

x=`sudo find /test -name "*.php"` echo $x p421.php p423.php read-session.php I want to cut the $x with space white as delimiter echo $x|cut -d " " cut: you must specify a list of bytes, characters,...
user avatar
  • 133
2 votes
1 answer
11k views

Move all the files and folders with CMD (BAT File)

I want to move all the files and folders inside the folder "C:\Foldertest\" into the folder "C:\Foldertest\target". And whenever I run this command, it does this for all files and folders except for ...
user avatar
1 vote
0 answers
2k views

Is it possible to cut mp3 file with Audacity without losing any quality (recording, etc.)?

I want to cut mp3 files with Audacity without losing any quality (recording, etc.). I am aware of other options but I want to do it with Audacity if possible because I use it for other things too.
user avatar
  • 501
-1 votes
2 answers
163 views

find number of teams from a file [closed]

I have started learning bash very recently and have to find the number of teams from a file, the file can be downloaded from this link. Below is a sample I understand that I have to use cut and uniq ...
user avatar
  • 1
5 votes
2 answers
7k views

Black frames at beginning of video file when file cut

I use ffmpeg to cut a video file. The format i use is this: ffmpeg -i input.avi -ss 00:06:30 -to 00:07:15 -c copy output.avi Unfortunately this leaves some black frames in the beginning of my output ...
user avatar
0 votes
2 answers
187 views

In excel 2010, pushing ctrl+x will delete the highlighted words. They are not saved to the clipboard. Can't be recovered with undo. Why?

UPDATE: This only seems to happen when I push Ctrl+X, then Ctrl+C after. This will erase the cut from the clipboard and Ctrl+Z will not undo the cut. When I am editing text (in this case, Japanese ...
user avatar
1 vote
1 answer
793 views

Use section sign § as cut delimiter

I thought this would be pretty straight forward echo "1§2" | cut -d § -f 2 should give "2", right? But whatever I try echo "1§2" | cut -d § -f 2 echo "1§2" | cut -d \§ -f 2 echo "1§2" | cut -d "§" ...
user avatar
2 votes
1 answer
1k views

Printing all columns after 5th with awk

I'm using this to filter a logging file and I'm trying to squeeze as much relevant detail as I can onto the console: awk -F " " '{$1=$2=$4=$5=$6=$7=""; print $0}' This is my raw input: 149.177.5....
user avatar
  • 188
0 votes
0 answers
264 views

awk and cut on a very large file

I have to extract a column of data from a very large file >100GB. I know how to use the awk and cut commands do it, but would like to know if one is more efficient (from a speed perspective) for ...
user avatar
  • 8,282
1 vote
1 answer
3k views

Cut part of every line in file possible?

I need to cut/copy part of lines only - is this possible in notepad++? See image for (maybe) better explanation - I need to cut/copy the blue square. Thanks
user avatar
0 votes
1 answer
72 views

Audacity | Split | duplicate split-positions onto another layer

Audacity_2.1.2 win10_Home_x64 AUDACITY How to do a split Edit -> Clip-Boundaries -> Split depending on whether it's a point vs. selection CTRL-I Point vs. Selection Point A point will only ...
user avatar
  • 472
0 votes
1 answer
331 views

Cut Video with FFmpeg

I have a video 20 muminute long time, I want to cut the first 5 minutes and 5 minutes of video finally. I have to use commands like, can help me? I user commant here: ffmpeg -ss [start_seconds] -i [...
user avatar
  • 13
1 vote
1 answer
695 views

how to filter text file on the basis another text file

I have two text files. One is wordlist and another one is file to be filtered. I want to remove or delete all the lines or links from the file if the line has any word from word list anywhere in the ...
user avatar
-1 votes
1 answer
59 views

How can I filter a list of files to download those that don't already exist?

I have downloaded some files into a folder, but the download was interrupted and not all the files were downloaded. I do not want to redownload the gigabytes-worth of files I already have; I now want ...
user avatar
3 votes
1 answer
7k views

How to `cut` (extract a subset of columns) a CSV file that contains quoted strings`

I have a CSV file and want to discard a couple of columns. So let's say this is a sample file: column a, column b, column c value a, value b, value c value a, "quoted, b", value c And now let's ...
user avatar
  • 645
7 votes
2 answers
11k views

How to echo only 1st line from 'curl' command output?

I'm trying to get only first line of the curl command output. (Sorry if this is confusing) Let's say, for an instance, i run simply: # curl http://localhost <!-- This is the hidden line i want to ...
user avatar
0 votes
4 answers
2k views

Which program I can edit video (cut some scenes) without increasing the video's size

I have a video: Input.mp4 - length: 29 min 6 sec - size: 120 MB I use Microsoft Movie Maker 2012 (Movie Maker is included in the Windows Essentials 2012 program suite), to cut some boring scenes and ...
user avatar
0 votes
3 answers
7k views

cut: |: No such file or directory

while read line do echo $line calendar_date=$(cut -d\ -f1 $line) hr_of_day=$(cut -d\ -f2 $line) echo "date: $calendar_date hr: $hr_of_day" done < $FILE I ...
user avatar
1 vote
1 answer
4k views

Error with command cut: the delimiter must be a single character

I am trying to run this command from console: # HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1` But got this error: Try `cut --...
user avatar
  • 341
0 votes
1 answer
2k views

need to get average idle time using mpstat

I want to get average idle time of the server using mpstat. The problem I am having is %idle is not in same columns in all the versions of linux. example 1: [root@testserver ~]# mpstat 1 2 Linux 2....
user avatar
  • 357
0 votes
1 answer
328 views

Piping a line of the file read with while read loop

I am trying to read each line of the file and then assign some parts of it to variables. A line itself is read as a variable so I need to process a variable input say for cat which seems to be ...
user avatar
  • 1
1 vote
1 answer
310 views

Cut lies if delimeter doesn’t exist

For example: $ cut -d ' ' -f 2- <<< "example" example Why does cut lie to me telling me that “example” is the second delimeter and on. I want it to print "" since there is no second ...
user avatar
  • 653
2 votes
1 answer
631 views

Cutting out two parts from the middle of a video with ffmpeg

I have two files, rec.avi and audio_edited.wav, and what I'm trying to do is take the parts 00:30:50–01:42:56 and 02:16:55–04:03:10 of each file, concatenate those and encode them into an WebM file. ...
user avatar
  • 31
2 votes
1 answer
2k views

How to Extract Multiple substrings from Log FIle

I am trying to extract the timestamp and the number string in the URL called in an apache logfile that looks like this: 123.456.78.90 - - [16/Dec/2014:06:27:30 +0100] "GET /servlet/something....
user avatar
1 vote
2 answers
97 views

How to retrieve a name from another file with a Bash script?

I would like to grab a name out of another predefined file and use it within my shell script. The file being read would be in ./docs/description.org and the format (a table in .org format) is: ......
user avatar
1 vote
1 answer
2k views

Cut - the delimiter must be a single character

I am trying to cut the information from a variable of a variable. I am using csh. Ex: setenv time \`date | cut -d ' ' -f 4\` echo $time setenv hour \`$time | cut -d \':\' -f 1\` echo $hour Output: ...
user avatar
1 vote
1 answer
96 views

Cutting input with cut or awk?

I'm basically trying to parse raw IRC input with a bash script, and I want to grab the messages, and nothing else. An example of what I'm trying to save is :user!~name@host.name PRIVMSG #channel :...
user avatar
  • 111
4 votes
2 answers
2k views

Bash command substitution not working as expected

I'd like to view the last few lines of a file, but I want the columns aligned. Basically, I want to disable wordwrap. This is straightforward with: tail $FILE | cut -c -80 But I'm trying to ...
user avatar
2 votes
1 answer
628 views

Inconsistent results using cut on output of ls

I am struggling to understand why I get different output from the same command run on a single file in Terminal (Mac OS X 10.6.8) and run on more than one file. As I want to run the command in a bash ...
user avatar
2 votes
3 answers
11k views

In bash, how do I pass the while loops input to the cut command?

How do I pass the $line to the cut command properly in this loop? while read line do login= $(cut -d : -f 1) done < /etc/passwd I can't do $(cut -d : -f 1 $line) so what is the correct way?
user avatar
  • 1,217
1 vote
1 answer
5k views

How to use cut command in UNIX?

I have a really large text file (~80 Million records/lines), where each record has 7 attributes. Between every attribute there is a tab. What I want to do is copy every third and last attribute/token ...
user avatar
  • 347
1 vote
5 answers
9k views

How to grep column after second pipe

Example: 3|100|test@test.com|0|0|6:1,10,11,12,13,2,3,4,5,6,9|7:1,10,11,13,16,2,4,5,6,9| Expected view after grep: test@test.com
user avatar
2 votes
1 answer
9k views

Add character at certain position in line

I've encountered the following problem: I need to add space at certain position in each line, to transform data from ATOM 1 HT1 GLY 5 10.346 30.927 130.252 0.00 0.00 to (by adding ...
user avatar
  • 2,810
4 votes
1 answer
5k views

GNU sort and git blame

Today I thought I was doing a simple operation: git blame file | sort -k 3 To get all the lines of file sorted by the date on which they were last changed. Unfortunately it doesn't seem to be ...
user avatar
  • 2,283