All Questions
1,090
questions
1
vote
2
answers
183
views
Divide a fasta file with scaffolds into same lenght files respecting the scaffold ID and the sequence
I am currently working with a large fasta file (3.7GB) that has scaffolds in it. Each scaffold has a unique identifier that starts with > on the first line and on the consecutive line it has the ...
-1
votes
1
answer
228
views
Extract patterns from tsv table listed in the separate text file and add first 5 cells from the corresponding row
I am trying to extract some specific entries from a large tsv table using a list. I also need corresponding data in the first 5 columns.
listfile.txt
entry123
entry532
entry685
entry555
...etc...
...
0
votes
1
answer
38
views
Save output of xdpdump to a variable
How can I save the output of xdpdump to a variable. I just want to save the number of packets captured.
root@front:/home/ubuntu# timeout 2s xdpdump -i ens3 -w lol.pcap
listening on ens3, ingress XDP ...
1
vote
5
answers
6k
views
Print ONLY the next line after a match with awk
I have a command that prints the line directly after a match with several pipes using different tools like grep, awk, and tail. This works but it feels somewhat messy and uses multiple pipes to ...
-1
votes
2
answers
6k
views
AWK or grep with cut. Need help cutting a field
I have this file and need to cut field 3 which should be cut - f 3. Right? I am using this code and its absolutely not doing anything for me.
grep '^2014-' FileName | cut - f 3| less
0
votes
2
answers
94
views
Extract all subnets from its first common octet
I have a list of subnets in a file. I just need to extract those subnets which have common octet as mentioned.
I tried using grep "grep -oP '1.[^"]+' but still I got some different results....
-1
votes
3
answers
471
views
How to match end of last string in file which does not end with punctuation
I'm trying to search a directory for files which do not end in a period. I'm trying to list the file name with the final ascii character which is not followed by period/ punctuation. I've looked all ...
1
vote
2
answers
86
views
Arranging the lines in required order
A file contains lines as follows:
acb/xyz/row<t>
acb/xyz/row<t>
abc/xyz/row<1>
abc/xyz/row<1>
abc/xyz/row<0>
abc/xyz/row<0>
abc/xyz/row<3>
abc/xyz/row<3>...
7
votes
4
answers
1k
views
How to use sed, grep, or awk to keep certain lines in a file depending on line numbers in another file
I have two files. File1 contains some sentences, and File2 contains the line numbers I want to keep in File1.
For example, File1:
He is a boy.
She is a cook.
Okay.
She went to school.
She is pretty.
...
-3
votes
1
answer
38
views
grep/awk/sed lines from match until text
I would like to get the following output from lscpu:
(number of cores) x (cpu model name) @ (max mhz)
I already figured out the attribute I need:
Model name:
Core(s) per socket
CPU max MHz
But on ...
1
vote
1
answer
111
views
Match if a column from one file partially matches a column in another file then print columns from both files
I have 2 files in which the fields are comma separated-
aks@dev1:~$ cat dir.txt
/home/aks/cleanup,512
/home/aks/git,208
/home/aks/github,424
/home/aks/predirsize,216
/home/aks/sample,288004
aks@...
0
votes
1
answer
67
views
Get rid of UNIX redirection newly created file without using rm
Using below function to filter out text file and organize to new format.
Using unix redirection > command to create new files.
How can I get rid of creating all new files
(e.g. ${file}_final_1.txt,...
2
votes
1
answer
2k
views
How to get specific fields of JSON objects for which another field is true
I want to get a specific info from the below command
[root@test opc]# /bin/oci compute instance list-vnics --instance-id ocid1.instance.oc1.ap-mumbai-1....
4
votes
6
answers
3k
views
grep the last occurrence of a pattern before another pattern
I have a huge file contains two types of patterns say pattern1 and pattern2, pattern1 may appear many times before pattern2 appears.
I want to grep the last occurrence of each pattern1 before each ...
2
votes
4
answers
292
views
Show changes between consecutive lines of a file
Is there an easy way to see how lines are changing in a file?
For example, assume I have this "my.log" file:
cpu1 cpu2 cpu3 cpu4
5 3 3 6
5 3 3 6
5 0 3 6
...