All Questions
19 questions
-2
votes
2
answers
56
views
Renaming object or element in perticular range in a column of text file
To expand on my previous question, I have another pattern of a file, I am trying to change the name of first column ranging from seq1 to seq20 (seq1-seq20) as seq1 similarly ranging from seq21 to ...
0
votes
1
answer
356
views
awk prints if and else case
I wrote the following command: lsblk -nl /dev/sdd -o MOUNTPOINT | awk '{if (NR!=1 && $1) { print 1; } else { print 0; }}'
It is supposed to check if any of the paritions of the given device, ...
1
vote
1
answer
301
views
Map field of first file based on patten matching in second file
I have two tab-delimited files where I need to match text in the first column of file 1 to any position in lines of file 2. Upon a match I then want to print what's in the second column of the ...
0
votes
3
answers
3k
views
Command to extract header of multiple files present in a directory [closed]
For example : there are 50 files present in a Unix directory ,I want to extract header of all the files and write it to a CSV file . CSV file will contain 2 columns 1st column - file name and 2nd ...
0
votes
1
answer
344
views
Locating a process ID by CPU usage (Ubuntu) using AWK
I have a command that I run to try and list PID's and their CPU usage. I am using ps -ef.
Is there a (better) way to do this using top? Also, I had a question about my awk statement. My variable $...
0
votes
2
answers
1k
views
SED or AWK to remove everything before the first dash and after the last
I have a private key file with some extra nonsense in there, and want just the text of the key.
so:
nonsense -----Begin Key-----
keep this1
keep this2
keep this3
-----End Key----- nonsense
should ...
0
votes
2
answers
140
views
Extract and rearrange from file
I have file which I want to extract and rearrange certain data , Old file contains a raw data this file is Input
reference:cve,2017-8962
sid:45885
reference:cve,2016-10033
reference:cve,2016-10034
...
1
vote
2
answers
451
views
How to match a column from File1 to get its corresponding fasta sequences in File 2?
May I kindly ask how to match all values of the first column in File with the line text in File 2 so I can copy the fasta sequences of all Object ID in File 1?
File 1.csv file
Object_ID, Length, ...
9
votes
4
answers
52k
views
script / command to get IPs from list of hostnames and combine into a single file
This is beyond my current skills it seems as I've been trying for a while and not making much headway.
I've been asked to get a list of hosts and IPs for security to run a scan against those servers. ...
3
votes
1
answer
8k
views
How to use awk command to calculate the date difference between two columns in the same file?
I have a multi columns csv file, comma separated which has two columns with different date (mm/dd/yyyy). I am going to identify the difference between these two date. following is the example:
echo ...
0
votes
3
answers
683
views
Formatting output from awk command in script
If I run this command:
awk -F'[="]+' '/^(NAME|VERSION)=/{printf("%-17s: %s\n",$1,$2)}' /etc/os-release
from a terminal, I can retrieve this:
NAME : Debian GNU/Linux
VERSION : 8 ...
1
vote
1
answer
235
views
How to use awk to correct and unify a corrupted file with multiple columns and lines?
I have a CSV formatted multi lines file with 5 columns (fields). I need to unify and corrected the corrupted first column which has lots of different formats of the code I need to unify. The complete ...
2
votes
1
answer
67
views
How I can find line(s) which the third columns is not digit/date?
I am trying to use awk command to find line(s) which the third columns is not digit/date? Suppose there is a file comma "," field separated, has three columns and as code "," measure "," dd/mm/yyyy,
...
2
votes
6
answers
2k
views
awk / sed / etc. concatenating colums in one file
I wonder what is a simpler way to do this:
awk 'NR > 1 {print $1"\t"$2"\t"$3"\t"$4"\t"$5"\t"$6"\t"$7"\t"$8"\t"$9$10$11$12$13$14$15$16}' file.in > file.out
which is simply speaking " ...
-2
votes
2
answers
1k
views
standard deviation using awk [closed]
I am using below command to get standard deviation of file A names
1 2 3 avg
23.3107 20.0372 21.7236 21.6905
awk '{x[NR]=$0 ;} END{a=$4; for (i in x){ss += (x[i]-...