Search Results

Search: Posts Made By: redse171
1,309
Posted By disedorgue
Hi, With (gnu) awk: awk 'BEGIN{OFS="\t"} ...
Hi,
With (gnu) awk:
awk 'BEGIN{OFS="\t"}
/ID/,/TM/ {
if($1 ~ "ID") ID=$2
if($1 ~ "TM") TM=$2
if($1 ~ "AC") {
gsub(/;/,"")
for (i=2;i<=NF;i++) AC[k++]=$i
}
}
/TM/{
k=0...
1,532
Posted By Chubler_XL
How about this awk ' BEGIN{ ...
How about this

awk '
BEGIN{
for(i=split("ID ACC TOS TMA KAW FEA TT", k);i;i--) keep[k[i]];
}
$1 in keep { s=s "\n" $0 }
/^DOR[ \t]+TDP/{ s=s "\n" $0 }
$1=="COM" && /-@- Full Comment/...
1,214
Posted By Akshay Hegde
Try Input [akshay@nio tmp]$ cat file ...
Try

Input
[akshay@nio tmp]$ cat file
192.98.1 192.98.192.98.17 VVC family Zorro 10
192.98.1 192.98.192.98.17 VVC family Ace ...
1,214
Posted By pravin27
How about this ? awk...
How about this ?

awk 'NR==FNR{a[$(NF-1)]=$(NF-1);next}
{if (FNR==1) { asort(a) ; printf "Fam\t\tNo\t\tName\t" ; for ( j in a ) { printf a[j] FS }} if ( !b[$1,$2] ) { if ( FNR>1) { for(j in a)...
1,885
Posted By Aia
R=(S1>Q1) ? Ql/Sl : Sl/Ql This statement makes...
R=(S1>Q1) ? Ql/Sl : Sl/Ql This statement makes use of the ternary operator evaluation ? :
Evaluates (S1>Q1) if is true uses the first portion after the `?' that is Ql/Sl, if is false uses the...
1,885
Posted By disedorgue
Hi, Another way: awk 'BEGIN{FS=OFS=" ~ |\t"} ...
Hi,
Another way:
awk 'BEGIN{FS=OFS=" ~ |\t"}
($7>$9 && $6>$8 && Hl=$9-$6) || ($9>$7 && $8<$6 && Hl=$7-$6) {
Ql= $7-$6;
Sl= $9-$8;
Qc= (Hl/Ql)*100;
Sc= (Hl/Sl)*100;
Diff=(Sl>Ql) ?...
1,885
Posted By Scrutinizer
This seems to do the same and is somewhat...
This seems to do the same and is somewhat shorter:
awk '
BEGIN{
FS=" ~ |\t"
OFS="\t"
}
{
if($7>$9 && $6>$8)
Hl=$9-$6
else if ($9>$7 && $8<$6)
Hl=$7-$6
...
1,758
Posted By Akshay Hegde
$ awk 'function p(regex){match($0,regex);return...
$ awk 'function p(regex){match($0,regex);return substr($0,RSTART,RLENGTH)}{print p("DSU[0-9]+T[0-9]"),p("(IN|OUT)[[:space:]]+[0-9]")}' file

DSU17281T6 OUT 0
DSU17282T0 OUT 5
DSU17283T0 OUT ...
1,758
Posted By shamrock
This should work albeit untested... awk...
This should work albeit untested... awk '{for(i=1;i<=NF;i++) if($i ~ "^(IN|OUT)$") print $3,$i,$(i+1)}' file
2,166
Posted By Don Cragun
Here is how I would do it (now that we know how...
Here is how I would do it (now that we know how you want to handle the case that wasn't covered by your description). It is similar to SriniShoo's code, but formatted in a way that I find easier to...
2,166
Posted By SriniShoo
awk -F '\t' 'NR == FNR{if(NR == 1) {for(i=2;...
awk -F '\t' 'NR == FNR{if(NR == 1) {for(i=2; i<=NF-1; i++) H[i]=$i; next};
for(i=2; i<=NF-1; i++) if($i == "Yes")
A[$1] = (A[$1] == "") ? H[i] : (A[$1] "," H[i]); B[$1] = $NF; next}
{print...
2,166
Posted By RavinderSingh13
Hello, Following may help you. (It will...
Hello,

Following may help you. (It will give Tra word at last)


cat check_file2.ksh
awk 'NR==FNR{
{if(FNR==1)
{for(i=1;i<=NF;i++)
{Y[i]=$i}
}
}...
2,166
Posted By Don Cragun
And if you have a line in file_1 like: ...
And if you have a line in file_1 like:
k12345 No No No No No No No Yes
what is supposed to be added to the corresponding line in file_2?
- Noor:
- Yes
1,352
Posted By Scrutinizer
Good to hear... The first element of the array...
Good to hear... The first element of the array contains the empty string before the first opening parenthesis..

If we take the second field of the first line as an example:
(EC 3.2.1.99)...
1,352
Posted By bakunin
"awk | sed" is - whatever the arguments to the...
"awk | sed" is - whatever the arguments to the commands might be - eo ipso wrong.

First, read the lines and split them into field. You say they are separated by tabs. In the following "<t>" means...
1,352
Posted By Scrutinizer
With awk you can use split() to further select...
With awk you can use split() to further select the subfields that you need:
awk '{split($2,F,/[()]/); print $1, F[2], $3}' FS='\t' OFS='\t' file

/[()]/ means that parentheses should be used to...
2,463
Posted By RavinderSingh13
Hello redse171, Following may also help. ...
Hello redse171,

Following may also help.


awk '{a=$1; gsub(/\,|\;/,"\n" a OFS,$0); print}' filename


Output will be as follows.


Ac020 Not a good chemical process
AC030 ...
2,463
Posted By Chubler_XL
You can also do this with sed: sed -E ':a ;...
You can also do this with sed:

sed -E ':a ; s/^([^ \t]+[ \t]+)([^,;]+)[,;][ \t]*/\1\2\n\1/; ta' infile
2,463
Posted By Akshay Hegde
This also will work bit lengthy $ awk...
This also will work bit lengthy

$ awk 'match($0,regex){ n=split(substr($0,length($1)+1),A,regex); for(i=1;i<=n;i++)print $1,A[i]; next }1' regex='[;,]' file

awk...
2,463
Posted By Akshay Hegde
Try $ cat file Ac020 Not a good chemical...
Try

$ cat file
Ac020 Not a good chemical process
AC030 many has failed, 3 still maintained
AC040 Putative; epithelial cells
AC050 Predicted binding activity
AC060 rodC Putative;...
1,047
Posted By RudiC
Will the func<TAB>null always follow other func...
Will the func<TAB>null always follow other func occurrences? Then tryawk '/@@/{CNT=0} /func.*null/ && CNT {next} /func/ {CNT++}1' file
1,047
Posted By RudiC
Not when I tried it:;; ID T08578 NAME ...
Not when I tried it:;;
ID T08578
NAME T08578
SBASE 30696
EBASE 32083
TYPE P
func just test
func chronology
func cholesterol
INT 30765-37333
INT 37154-37318...
3,874
Posted By RudiC
Further simplification:awk '$2 != "CD" ...
Further simplification:awk '$2 != "CD" {next}
!($7 in LINE) {LINE[$7]=$0}
{CNT[$7]++; E3[$7]=$3; E4[$7]=$4}

END {for (i in LINE) if...
3,874
Posted By Don Cragun
It is no wonder that the results you are getting...
It is no wonder that the results you are getting are not what you want. Your description of how to process the input is so vague that we do not understand what you want.

The code you showed us...
3,874
Posted By jethrow
awk ' $2=="CD" { key=$5"|"$9"|"; ...
awk '
$2=="CD" {
key=$5"|"$9"|";
($3>A[key"max"] || A[key"max"]=="")? A[key"max"]=$3:"";
($4>A[key"max"] || A[key"max"]=="")? A[key"max"]=$4:"";
($3<A[key"min"] || A[key"min"]=="")?...
Showing results 1 to 25 of 100

 
All times are GMT -4. The time now is 12:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy