awk - bash - check for word in specific column, check value in other column of this line, cut and paste the line to new text file -
My text files contain ~ 20k lines and look like this:
file_A:
Atom 624 SC1 SER 288 54,730 23,870 56,950 1,00,0,00 Atom 3199 NC3 Pop 487 50,780 27,750 27,500 1,00 3,18 Atom 3910 C2B Pop 541 96,340 99,070 39,500 1,00 7, 00 Atom 4125 W PW 559 55,550 64,300 16,880 1,00,00
Now I need to check POP in column 4 (row 2 and 3) and check Is the value of the previous column (10) greater than a specific threshold (i.e. 5.00) These lines - in this case only 3 lines - need to be removed from file_a and copied to a new file. Meaning:
file_A:
Atom 624 SC1 SER 288 54.730 23.870 56.950 1.00 0.00 Atom 3199 NC3 Pop 487 50.780 27.750 27.500 1.00 3.18 Atom 4125 W PW 559 55.550 64.300 16.880 1.00 0.00
file_B:
Atom 3910 C2B pop 541 96.340 99.070 39.500 1.00 7.00
I am not sure whether I am in the weather to use Cal, GRP or AVC or some couple: / By now I can simply delete lines and make a new file without these lines I ...
awk '! / POP / 'file_A & gt; File_B
Does a different word have been removed from
((i =; i & lt; $ numberoflipids; i ++))? Do awk '$ 4 ~ /' $ {Nol [$ i]} "/ & amp; & Amp; $ NF & gt; "$ PR" {Print & gt; "Patch_rmlipids.pdb"; Next} {Print & gt; "TMP"} 'Belair_C CG_ordered.pdb & amp; Amp; MV TMP patch .pdb
While $ nol is an array in which words can be removed, $ PR is the given threshold and files used in .pdb are
Thanks again in advance :-) Ueffes
awk
< Code> awk '$ 4 ~ / POP / & amp; Amp; $ NF & gt; 5 {Print & gt; "Fileb"; Next} {Print & gt; "TMP"} 'file & amp; Amp; . Mv tmp filea
$ 4 ~ / pop / & amp; & Amp; $ NF & gt; 5 -Checks fourth area pops up and if the previous area is more than five (print> "fileb"; next) -If they write a line for the file and skip further details {Print & gt; "TMP"} - Only if the first part fails, then write the TMP file file and press & Amp; Mv tmp filea-file has been used, if the awk command is successful, it overwrites it with tmp
Comments
Post a Comment