cut Questions

4

Solved

I need to change the order of a string in AIX, but with the command cut I can't do it Ex: echo FT0215202301.xml | cut -b 7-10,5-6,3-4 Result: 02152023 Expected: 20230215
Cesar asked 23/9, 2024 at 19:15

4

Solved

I'd like to get the pid from my processes. I do ps aux | cut -d ' ' -f 2 but I notice that sometimes it gets the pid and sometimes it does not: [user@ip ~]$ ps aux user 2049 0.5 10.4 6059216 1623...
Dania asked 1/9, 2017 at 22:53

13

Solved

Is there a way to specify multiple spaces as a field delimiter with the cut command (something like a " "+ regex)? For example, what field delimiter I should specify for the following str...
Euromarket asked 22/8, 2011 at 2:52

6

Solved

I'm trying to extract a certain (the fourth) field from the column-based, 'space'-adjusted text stream. I'm trying to use the cut command in the following manner: cat text.txt | cut -d " " -f 4 ...
Plourde asked 10/11, 2010 at 10:4

8

Solved

I have text like this: word1 word2 word3 word4 There may be more than one space between a pair of words and I want to get some columns of words from each line . When I use cat file | cut -d ' ' ...
Angieangil asked 24/1, 2014 at 1:53

11

Say I have the following csv file: id,message,time 123,"Sorry, This message has commas and newlines",2016-03-28T20:26:39 456,"It makes the problem non-trivial",2016-03-28T20:26:41 I want to ...
Counterchange asked 29/3, 2016 at 15:0

8

Solved

I have a file that is HTML, and it has about 150 anchor tags. I need only the links from these tags, AKA, <a href="*http://www.google.com*"></a>. I want to get only the http://www.googl...
Devinne asked 21/1, 2014 at 17:7

2

I am trying to use fzf in the following manner, I would like to be able to search for a term within my codebase and then with the preview window be able to see the file which contains the string I ...
Falsity asked 15/3, 2019 at 16:20

16

Solved

What's wrong with the following code? name='$filename | cut -f1 -d'.'' As is, I get the literal string $filename | cut -f1 -d'.', but if I remove the quotes I don't get anything. Meanwhile, typi...
Doddered asked 28/8, 2012 at 4:6

3

Solved

I have a numeric vector that I want to convert to five numeric levels. I can get the five levels using cut dx <- data.frame(x=1:100) dx$cut <- cut(dx$x,5) But I am now having problems extr...
Attributive asked 8/9, 2016 at 9:48

14

Solved

Without using sed or awk, only cut, how do I get the last field when the number of fields are unknown or change with every line?
Gibberish asked 29/3, 2014 at 4:43

8

Solved

I have the string as show below: XXX:Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur cursus lacus sed justo faucibus id pellentesque nunc porttitor. Sed venenatis tempor dui, ne...
Polychromy asked 8/12, 2011 at 19:28

5

Solved

a.txt contains 500,000 columns and 2000 rows. The example file below only shows the first 9 columns in this file. This file has header in the first row. chromosome SNPID rsid position alleleA allel...
Chondroma asked 5/12, 2022 at 14:58

3

I'm working on a Makefile. version := v39.0.12.8 // format rules: va.b.c.d I want to get "version_a" based on the format, which is "39" in this case. How to do this? Maybe via "sed/cut/awk but ...
Lightship asked 21/5, 2020 at 8:24

8

Solved

Following some great advice from before, I'm now writing my 2nd R function and using a similar logic. However, I'm trying to automate a bit more and may be getting too smart for my own good. I wa...
Percale asked 30/7, 2012 at 19:40

17

Solved

Suppose I have the string 1:2:3:4:5 and I want to get its last field (5 in this case). How do I do that using Bash? I tried cut, but I don't know how to specify the last field with -f.
Perennial asked 1/7, 2010 at 23:29

6

Solved

I need to cut parts from an audio file from position to position. When I tried this command ffmpeg -ss 132 -t 139 -i original.mp3 new.mp3 it started at the second 132, and added the next 139 sec...
Ferrick asked 30/9, 2017 at 23:55

6

Solved

I have a very large tab separated file. The tab separated file is binary and will be streamed by the tool samtools (which is very fast and not the bottleneck). Now I want to output only the content...
Stich asked 4/7, 2022 at 10:15

3

Solved

Unix 'file' command has a -0 option to output a null character after a filename. This is supposedly good for using with 'cut'. From man file: -0, --print0 Output a null character ‘\0’ after the ...
Lifesaving asked 24/3, 2012 at 1:43

4

Solved

I am currently in need to extract the second word (CRISTOBAL) in a line in a text file. * CRISTOBAL AL042014 08/05/14 12 UTC * The second word in the line "CRISTOBAL" will vary from day to day ...
Loella asked 25/8, 2014 at 18:7

2

Solved

I want to cut a piece out of a video and burn subtitle in that piece. I can do this in 3 steps: cut the video ffmpeg -ss 25:00 -to 26:00 -i vid.mp4 -c copy out.mp4 cut the subtitle ffmpeg -i sub...
Pironi asked 3/1, 2020 at 8:27

19

Solved

I am working with two files, and I need to copy a few lines from one file and paste into another file. I know how to copy (yy) and paste (p) in the same file. But that doesn't work for different fi...
Maud asked 6/1, 2011 at 22:30

7

Solved

I've a file with the below name formats: rzp-QAQ_SA2-5.12.0.38-quality.zip rzp-TEST-5.12.0.38-quality.zip rzp-ASQ_TFC-5.12.0.38-quality.zip I want the value as: 5.12.0.38-quality.zip from the abov...
Broncobuster asked 26/10, 2021 at 15:51

10

Solved

Suppose I have a Unix shell variable as below variable=abc,def,ghij I want to extract all the values (abc, def and ghij) using a for loop and pass each value into a procedure. The script shoul...
Doublejointed asked 30/12, 2014 at 9:7

4

Solved

I'm trying to use Unix cut to remove the first two fields per line. I have input lines of of the form (token)(whitespace)(token)(lots of text) The problem is that there exit n tokens per line, so...
Roobbie asked 11/3, 2010 at 20:28

© 2022 - 2025 — McMap. All rights reserved.