I need to grep a file called daily_fails_count.csv but only find the number of failures. Inside that file is this, on a shorter scale: It’s format is “month,day,hours,failures.” It goes through all months. The last value is the number of failures found at that time. I know here it all says 0…
Tag: awk
AWK with commands [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 3 years ago. Improve this ques…
Replace every second instance of word in each line of the file
I’m trying to replace every second instance word of each line with sed. For example: If I had a line as below should be replaced as below. Only second instance of word is replaced with kiran/. My attempt : Output: My Question: Please help me with the proper sed or any Linux command which does the above …
Doing an awk command for a conditional statement
I’m doing a bash script using the Awk command to format a file with some user info, and at the beginning of the script, I want it to say “if the value in column 1 is not in the format abc123, skip that line. It doesn’t seem to be working though. I had this previously: but of course that woul…
Use awk to replace one column value with another column value if the first letter is not a alphabet letter
I have the following csv file: What I want to do is to replace ID colunm’s value with NID value if the first letter in ID is not a alphabet letter. So the output is expected to be This is just a sample. My original data size is much bigger so I have to use awk. The key issue is
Arithmetic in Shell script
After executing this Here $20 indicates the “S:” entry in each row (I am taking the unique count of all s values),I am getting result as so what I need is the sum of all occurrence of s values .i.e 93070+11666+230 so result be total=104966 Answer
capturing words between double quotes in awk
I’m trying to print the name of my Linux distribution. The output of cat /etc/os-release for my distro is: Now I want to grab the Arch Linux from the second line. I used this command: But this prints PRETTY_NAME=”Arch How can I grab the words (including space) from this line? Answer Setting the fi…
How to extract names of compound present in sub files?
I have a list of 15000 compound names (file name: uniq-compounds) which contains names of 15000 folder. the folder have sub files i.e. out.pdbqt which contains names of compound in 3rd Row. (Name = 1-tert-butyl-5-oxo-N-[2-(3-pyridinyl)ethyl]-3-pyrrolidinecarboxamide). I want to extract all those 15000 names b…
Bash loop only read the last line
I have problems trying to extract data behind colons in multiple lines using while loop and awk. This is my data structure: What I want to get is the BioSample ID, which is like SAMD00019077. Scripts I tried: while read line ; do echo $line | awk -F’:’ ‘{print $3}’ > 1.tmp2 ; done &…
How to split file based on first character in Linux shell
I do have a fixedwidth flatfile with the header and detail data. Both of them can be recognized by the first character: 1 for header and 2 for detail. I want to genrate 2 different files from my fixedwidth file , each file having it’s own record set, but without type record written. File Header.txt havi…