All Questions
Tagged with text-processing cut
110 questions
3
votes
3
answers
355
views
Large file manipulation
I have a Garmin Nuvi which uses OpenStreet maps. Garmin do postcodes, but is usually 2-3 years out of date for Scotland. OSM does not do British postcodes, but the Post office does, and it can be ...
1
vote
4
answers
485
views
Retrieve the 1st and 5th column of a tab-separated file, convert the spaces in the 5th to tabs
I have a tsv file with tab-separated columns. I want to obtain the 5th column, which has space-separated values. Convert the space-separation to tab-separation and save as a new file.
Attempt:
cut -d&...
2
votes
4
answers
477
views
linux command using trim / cut / sed to cut few data in a file
I have the content like below in a /tmp/myfileslist
test1/a/sample1.xls
test2/demo.sh
I want to remove .extentions and content before slash , also slash is to be removed.I want the output as
sample1
...
1
vote
1
answer
268
views
command for multiple input and multiple output
I am performing some operations using the grep, sed, and cut commands on a Linux machinete:
zgrep -A1 "^module" *.v.gz | sed -n -e 's/^\(module \)*\(.*(.*)\).*$/\2/p' | cut -f1 -d"(&...
4
votes
2
answers
1k
views
cut /etc/passwd but without colons (:) in the resulting set of fields
I want to list the username, id and group on /etc/passwd using the following format: username uid gid
I have used the following:
cut -d: -f1,3,4 /etc/passwd
But it returns username:uid:gid. How can I ...
1
vote
4
answers
338
views
How to get first Character of every underscore delimiter using bash
Hi Team there is a scenario where table name such as
head_must_report
customer_report_sub_division
country_code_universe_nation_part
However using cut command output should be as below. Note: table ...
0
votes
1
answer
119
views
Cut Command Question - Column pulls other column if missing data
I have an example file on a Linux system:
Sally Smith
John Smith
Bill
Sam
When I run this command I get the first column:
$ cut -d " " -f1 test.txt
Sally
John
Bill
Sam
When I run this ...
0
votes
5
answers
300
views
Delete columns that contains only numbers
I have a table that containes some data and I need to delete the columns that contains only number (Nr.,Cod,Tiraj):
Nr. Autor Titlu Cod Tiraj Tara
1 Gauss Carl ...
-1
votes
3
answers
68
views
I have a fix length file how to extract the data to looks like csv file
So I have the following file:
HDR2013100120131001000000000000 ...
1
vote
1
answer
92
views
How to only display the text after the third, first, and fifth comma in this order in Unix?
I want to display the text after the 3rd, 1st, and 5th comma from a given input text, in that order.
Doing cut -d ',' -f 3,1,5 does the job but doesn't keep the order I want. Instead, it displays the ...
0
votes
3
answers
92
views
extract certain substring
I have a file like this:
RSID1 RSID2
chr1_169894240_G_T_b38 chr1_169894240_G_T_b38
chr1_169894240_G_T_b38 chr1_169891332_G_A_b38
chr1_169891332_G_A_b38 chr1_169891332_G_A_b38
chr1_169661963_G_A_b38 ...
0
votes
2
answers
117
views
Unix command to cut between strings
my file:
Informatica(r) PMCMD, version [10.2.0 HotFix2], build [1911.0401], Workflow run status: [Failed]
Output I need is Failed
Output I am getting is 10.2.0 HotFix2
Command used:
grep "...
0
votes
1
answer
273
views
print the next word after a match
I am trying the following in a bash script on Linux:
envA="prdk8s--staging-a"
envB="prd-k8s--sandbox"
for envCode in $envA $envB;
do
Code=$(echo $envCode | cut -d "--"...
1
vote
2
answers
332
views
How to get a specific set of characters from a string using cut (or not)
I am trying to extract the PHP version from this command: php -v
php -v
PHP 7.3.27-9+ubuntu20.04.1+deb.sury.org+1 (cli) (built: Feb 23 2021 15:10:30) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend ...
0
votes
2
answers
115
views
Removing strings after first space only in first column
The following file is tab-separated. I tried to remove from the first column NbLab330C00 64506568 the number after space in order to get NbLab330C00.
$ head LAB330_TE_annotation.gff3
##gff-version 3 ...