All Questions
119 questions
2
votes
1
answer
33
views
subset my .fam file using a .txt file of names
I have a .fam file in plink format, looks like this
1 I001.HO 0 0 1 1
2 I002.HO 0 0 1 1
3 IREJ-T006.HO 0 0 1 1
4 IREJ-T009.HO 0 0 1 1
5 IREJ-T022.HO 0 0 1 1
6 IREJ-T023.HO ...
0
votes
2
answers
116
views
How to copy the value from one "column" to another in Bash?
I have a file with lines:
username="user1" email="[email protected]"
I need to take the username from the email address and replace the username value with it,
so the end result ...
-3
votes
1
answer
77
views
How to convert multiple columns to rows in shell (unpivoting)
I have a tab separated table with hundreds of columns and rows, like that:
OTUId AC0184 AC0250 AC0257 AC0258 AC0262 AC0263 AC0289 AC0293
OTU549024624 51659 0 0 0 0 0 0 0
OTU565712448 108 0 0 0 0 0 0 0 ...
0
votes
2
answers
81
views
extract a column from the command output even if it blank bash
I am trying to extract 2nd column from a command output
For example:
$ sudo /usr/sbin/pvs
PV VG Fmt Attr PSize PFree
/dev/sdc1 vgswap lvm2 a-- 16.00g 0
/dev/sdc2 ...
0
votes
1
answer
233
views
How to only zcat files between two time durations?
Scenario:
I've a file called abcd.log.gz.
I want to zcat only the files from time durations 17:30:00 to 18:30:00.
Currently, I zcat the entire file. Then awk the logs between two time durations which ...
-2
votes
3
answers
127
views
bash + how to verify folders under specific path are ended with number/s
I want to check the folder/s under /var/kafka that all them are ended with number otherwhile I will exit with error
ls -ltr /var/kafka
drwxr-xr-x 399 kafka kafka 28672 Nov 9 13:10 data6
drwxr-xr-x ...
-1
votes
3
answers
153
views
How to execute a function inside system function in shell script?
I have a text file named meta.txt with the following information:
And a folder named data
output_folder = "data"
Want to execute a function named conv inside the system function like below,...
1
vote
3
answers
213
views
Linux bash awk print word with special letter
I have a URL:
www.google.com/word/word1/word_2/word3/word4
I would like to use awk to print only the words that contain the _ special character. Sometimes the folder hierarchy may change:
www.google....
2
votes
2
answers
334
views
Why does awk concatenate strings from different lines
Good day.
I'm trying to run a ping6 on IPv6 addresses pulled from /etc/resolv.conf.dnsph. It seems though, as if awk is stringing the IPv6 addresses onto one line.
$ grep ^nameserver /etc/resolv.conf....
0
votes
3
answers
118
views
bash awk how to exclude entries which contain the word 'Mouse'
The following bash command collects the xinput id's of all devices with a name that includes ILITEK ILITEK-TP.
name='ILITEK ILITEK-TP'
ids=$(xinput --list |awk -Fid= "/$name/"'{print $2+0}')
...
0
votes
1
answer
58
views
How to compare 2 files and print all the lines from 2nd file to output file bash script
I am trying to get the following output. I have 2 input files and we need only the common :names from both the input files along with there the lines below them the .name/of/file lines.
Till now I ...
0
votes
1
answer
203
views
awk transpose specific row to column and group them
I have the below data in a stdout:
13:46:17 0.8 cpu(1)
13:46:17 0.7 cpu(2)
13:46:17 1.1 cpu(3)
13:46:24 0.6 cpu(1)
13:46:24 0.5 cpu(2)
13:46:24 0.9 cpu(3)
13:46:31 0.8 cpu(3)
13:46:38 0.9 cpu(3)
13:46:...
0
votes
1
answer
343
views
Using variables in awk command
I am trying to find the UID in a certain range and only showing those UIDs with their name.
The range is determined by two arguments I enter in my command line.
However, I don't receive the right ...
0
votes
2
answers
126
views
How to split a directory of files into named sub-directories by file extension?
I have a directory with files like these
2022-11-08-0001.gzip
2022-11-08-0002.gzip
2022-11-08-0003.txt
2022-11-08-0004.png
2022-11-08-0005.txt
2022-11-08-0006.txt
2022-11-08-0007.png
2022-11-08-0008....
3
votes
2
answers
73
views
Add value found in a line to another line matching a specific field of the first line
Hope you are all doing well!
Here is what I am trying to achieve:
I have the following lines:
2022-10-19 09:12:39.174 WRITING bytes(2566), indexname(20220701_cfgsys_017507001635)
2022-10-19 09:12:39....