Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 2 3 4 c.2458C>T
- a b c d c.45_46delAA
- a1 b2 c3 d4 p.Ala78_Arg80del
- gawk -F 't' -v OFS='t' 'match($5, /[[:digit:]]+/, m) {$(++NF) = m[0]} 1' file
- 1 2 3 4 c.2458C>T 6 2458
- a b c d c.45_46delAA or f 45
- a1 b2 c3 d4 p.Ala78_Arg80del f6 78
- perl -F't' -lane 'print join "t", @F, $F[4]=~/(d+)/' file
- awk 'BEGIN {FS=OFS="t"} match($5,/[0-9]+/,arr) {print $0,arr[0]}' file
- $ cat file
- 1 2 3 4 c.2458C>T 6
- a b c d c.45_46delAA or f
- a1 b2 c3 d4 p.Ala78_Arg80del f6
- $ sed -r 's/([^t]*t){4}[^[:digit:]]*([[:digit:]]+).*/2/' file
- 2458
- 45
- 78
- sed -E 's/([^t]*t){4}[^[:digit:]]*([[:digit:]][[:digit:]]*).*/2/' file
- $ awk '{sub(/^[^[:digit:]]*/, "", $5); sub(/[^[:digit:]].*/, "", $5); print $5;}' file
- 2458
- 45
- 78
- sed 's/[^t0-9]*([0-9]*)[^t]*/1/5' <infile
- xsel -bo | unexpand -a | sed ...
- 1 2 3 4 2458 6
- a b c d 45
- a1 b2 c3 d4 78 f6
- <infile
- cut -f5 | tr -cs '0-9n' \t |
- expand -t1,2,4 | cut -d' ' -f-2
- 2458
- 45
- 78
- 2458 45 78
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement