using awk to parse a specific condition

justaguy

I am trying to use awkto parse multiple conditions and having some trouble with the first. I think the code below is close, but it does not return the desired output. The parse rules are: Thank you :).

  1. 4 zeros after the NC_ (not always the case) and the digits before the .
  2. g. ### g.###
  3. c
  4. t

    awk -F"[_.>]" 'FNR>1 {X=$4+0; sub(X, "", $4); print $2+0, X, X, $4, $5}' OFS="\t" ${id}_position.txt > ${id}_parse.txt

id_position.txt

Input Variant   Errors  Chromosomal Variant Coding Variant(s)
NM_004004.5:c.79G>A     NC_000013.10:g.20763642C>T  NM_004004.5:c.79G>A XM_005266354.1:c.79G>A  XM_005266355.1:c.79G>A  XM_005266356.1:c.79G>A

Desired output:

13     20763642     20763642     C     T
Jotne

This should do:

awk 'NR==2 {split($2,a,"[_.>]");b=substr(a[4],1,length(a[4]-1));print a[2]+0,b,b,substr(a[4],length(a[4])),a[5]}' OFS="\t" file
13      20763642        20763642        C       T

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Evaluating condition of if statement in awk using a second file

分類Dev

Parse specific links in html using HTMLParser in python?

分類Dev

Get the length based on specific condition using Angular.js

分類Dev

select all elements in a group that meet a specific condition using pandas

分類Dev

How to add an xml tag based on specific condition using python

分類Dev

how to parse a specific sentence?

分類Dev

Locking on condition and specific value

分類Dev

Agg and groupby by specific condition

分類Dev

Specific Regex/Regex Condition

分類Dev

VBScript if condition specific

分類Dev

How to uncomment the a specific line which contains specific text in a hocon file using bash script(sed,awk..etc)

分類Dev

Merge rows by duplicate columns in awk/unix with condition

分類Dev

awk if-greater-than and replace under condition

分類Dev

awk if-greater-than and replace under condition

分類Dev

Feedparser to Parse Specific Text in Entries

分類Dev

Parse Date and Time in specific format

分類Dev

Replacement in file with sed with specific condition

分類Dev

How to narrow an array for a specific condition?

分類Dev

Joi - use 'valid' for specific condition

分類Dev

Increment number using AWK

分類Dev

Using grep vs awk

分類Dev

Parse Error! using wordpress

分類Dev

Using for loop iterator for if condition

分類Dev

How to parse the line that has a specific word in it?

分類Dev

Cant parse specific Links with php dom parser

分類Dev

How to transfer to a specific storyboard if a condition is true?

分類Dev

how to remove observations in R dependent on a specific condition

分類Dev

Select rows with specific condition from other dataframe

分類Dev

print the ratio of Fibonacci numbers until a specific condition

Related 関連記事

  1. 1

    Evaluating condition of if statement in awk using a second file

  2. 2

    Parse specific links in html using HTMLParser in python?

  3. 3

    Get the length based on specific condition using Angular.js

  4. 4

    select all elements in a group that meet a specific condition using pandas

  5. 5

    How to add an xml tag based on specific condition using python

  6. 6

    how to parse a specific sentence?

  7. 7

    Locking on condition and specific value

  8. 8

    Agg and groupby by specific condition

  9. 9

    Specific Regex/Regex Condition

  10. 10

    VBScript if condition specific

  11. 11

    How to uncomment the a specific line which contains specific text in a hocon file using bash script(sed,awk..etc)

  12. 12

    Merge rows by duplicate columns in awk/unix with condition

  13. 13

    awk if-greater-than and replace under condition

  14. 14

    awk if-greater-than and replace under condition

  15. 15

    Feedparser to Parse Specific Text in Entries

  16. 16

    Parse Date and Time in specific format

  17. 17

    Replacement in file with sed with specific condition

  18. 18

    How to narrow an array for a specific condition?

  19. 19

    Joi - use 'valid' for specific condition

  20. 20

    Increment number using AWK

  21. 21

    Using grep vs awk

  22. 22

    Parse Error! using wordpress

  23. 23

    Using for loop iterator for if condition

  24. 24

    How to parse the line that has a specific word in it?

  25. 25

    Cant parse specific Links with php dom parser

  26. 26

    How to transfer to a specific storyboard if a condition is true?

  27. 27

    how to remove observations in R dependent on a specific condition

  28. 28

    Select rows with specific condition from other dataframe

  29. 29

    print the ratio of Fibonacci numbers until a specific condition

ホットタグ

アーカイブ