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

learn more… | top users | synonyms

1
vote
1answer
45 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 ...
0
votes
1answer
47 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 ...
0
votes
1answer
44 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 ...
1
vote
1answer
20 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 ...
1
vote
1answer
88 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. ...
1
vote
1answer
100 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 ...
0
votes
0answers
14 views

How to cut video using ffmpeg [duplicate]

I have a video file of 2 hours, but I want to remove the time from 00:45:00 to 01:05:00 and from 01:50:00 to 02:00:00. How can I do that? Please help.
0
votes
2answers
53 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: ...
0
votes
1answer
138 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: ...
1
vote
1answer
36 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 ...
4
votes
2answers
449 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 ...
1
vote
1answer
264 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 ...
2
votes
3answers
2k 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? ...
1
vote
1answer
4k 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 ...
1
vote
5answers
4k 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
2
votes
1answer
3k 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 ...
0
votes
1answer
1k 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 ...
0
votes
2answers
1k views

chained commands to create directories on a remote server

To get rsync cronjob working, I need to first create the dir tree on the remote server before running rsync. The local directories shall mirrored (w/o content) to the remote server. I'm strugglying to ...