2
votes
2answers
38 views

How do I use cut to separate by multiple whitespace?

I would like to get the last column of this sample: [ 3] 1.0- 2.0 sec 1.00 MBytes 8.39 Mbits/sec [ 3] 2.0- 3.0 sec 768 KBytes 6.29 Mbits/sec [ 3] 3.0- 4.0 sec 512 KBytes 4.19 Mbits/sec ...
3
votes
2answers
360 views

Cut command not extracting fields properly in aligned columns

I have a text file in which I must cut the fields 3,4,5 and 8: 219 432 4567 Harrison Joel M 4540 Accountant 09-12-1985 219 433 4587 Mitchell Barbara C 4541 Admin Asst ...
1
vote
2answers
77 views

Split out data from a column

So at the moment I have some input email addresses and would like to separate the alias and the domain, then copy them to the end of the line. For example, from a line that has ...
4
votes
1answer
260 views

Does the inverse command of cut exist?

First question, so if the format's not correct, sorry! I like using the cut command in Linux with the -c flag. However, I'm interested in finding a command that sort of does the set inverse of cut. ...
2
votes
4answers
2k views

print last field from line + alternative for awk

Due to technical reason on my Solaris machine, I can't use awk in order to print the last field in line. What are the other alternatives to awk that print the last field from line (using cut or tr ...
6
votes
2answers
3k views

How to cut (select) a field from text line counting from the end?

I know how to select a field from a line using the cut command. For instance, given the following data: a,b,c,d,e f,g,h,i,j k,l,m,n,o This command: cut -d, -f2 # returns the second field of the ...
3
votes
3answers
6k views

How to use cut command to get the first and last elements of a row?

I've asked almost the same question already, but this time, I want to retrieve the X latest elements of a row of a CSV file. For example, with an input file as this one: 1;foo;bar;baz;x;y;z ...
2
votes
2answers
1k views

Reorder fields/characters with cut command [duplicate]

Possible Duplicate: Combining 2 different cut outputs in a single command? I have One file - temp.txt - which contains ABCDF PQRST LMNOP I tried this cut command $ cut -c 2-5 temp.txt ...
9
votes
7answers
2k views

Combining 2 different cut outputs in a single command?

I have a file such as the following: 1234 ABCD EFGH I'd like to convert it to the following: 2341 BCDA FGHE The actual file has 4,000 words, so I would like to do this in an efficient manner. I ...
3
votes
2answers
365 views

Cut on both characters and field

I have a record like : 2011-05-29 17:51:34 => 'HS|CMGC|RN431|CI13950|CH7-4a37-afe2-acabfc9d262d|DA110529|TI175133|' I want my final output to be something like: 2011-05-29 17:51:34 CI13950 I ...
1
vote
1answer
636 views

Keep newlines in output of cut

Let's imagine we have a file: foo bar foo1 bar1 I want to cut every second word in every line, so I want file to look like this: foo foo1 I am trying to use cut -d ' ' -f -1 but what I get is: ...