Search Results

Search: Posts Made By: Tzole
1,436
Posted By ctsgnb
# cat foot ASP - GLN = 14 SER - GLU = 14 ...
# cat foot
ASP - GLN = 14
SER - GLU = 14
ARG - ASN = 13
ARG - TYR = 13
ASP - ARG = 13
GLU - ARG = 13
GLU - GLN = 13
ALA - ARG = 12
ARG - GLN = 12
ASN - ARG = 12
ASN -...
1,436
Posted By rbatte1
Is your file fixed width? If so, a (rather...
Is your file fixed width? If so, a (rather clunky) script could do this:-

#!/bin/ksh

for refs in `cut -d"=" filename | sort -u`
do
tot=0
grep "$refs" filename | while read a b c d...
2,273
Posted By hanson44
Here is a possibility. Instead of going through...
Here is a possibility. Instead of going through machinations with complex scripts, improve the file format first. The "Category of XXX", etc. information is redundant, already in field #3. "Category...
2,273
Posted By Scrutinizer
@rdrtx1: It is better to use SUBSEP to separate...
@rdrtx1: It is better to use SUBSEP to separate the fields in the index of the array.
a[$1,$2,$4,$5]

In the sample they all happen to have the same length, but if they vary in length then one...
2,273
Posted By rdrtx1
try: awk ' NR==FNR {if ($3!=cat)...
try:
awk '
NR==FNR {if ($3!=cat) a[$1$2$4$5]=$0; next}
$NF==cat
$3==cat {if (!a[$1$2$4$5]) print }
' cat="XXX" infile infile
1,200
Posted By user8
You could start with: awk '{a[$3 " - "...
You could start with:
awk '{a[$3 " - " $6]++}END{ for (i in a) print i, "=", a[i]}'
1,200
Posted By pamu
Blank
I am completely blank on this..

Please provide some more details. :confused:
1,625
Posted By pamu
or awk '{print $(NF-3)}' file
or
awk '{print $(NF-3)}' file
1,625
Posted By zaxxon
Like this? $ cat file7 aa bb cc me! ee ff...
Like this?

$ cat file7
aa bb cc me! ee ff gg
$ cat file8
aa bb cc dd me! ff gg hh
$ awk 'NF==7 {print FILENAME, $4; next} {print FILENAME, $5}' file*
file7 me!
file8 me!
3,663
Posted By rdrtx1
try: awk ' !f[FILENAME] {for (i in t) if...
try:
awk '
!f[FILENAME] {for (i in t) if (!a[i]) delete t[i] ; delete a; f[FILENAME]=FILENAME}
NR==FNR {t[$0]=$0}
{a[$0]=$0}
END { for (i in t) if (!a[i]) delete t[i]; for (i in t) print i}
'...
1,093
Posted By rdrtx1
In example: 6 cols, diff > .04? If so, try: awk...
In example: 6 cols, diff > .04? If so, try:
awk '
NR==FNR {a[$1$2$3$4$5]=$NF; next}
a[$1$2$3$4$5] {d=sprintf("%.2f",sqrt((a[$1$2$3$4$5]-$NF)**2)); if (d>.04) {$NF=d; print $0}}
' file1 file2
105,537
Posted By Neo
Forum Video Tutorial: How to Use Code Tags
How to Use Code Tags in The UNIX and Linux Forums

Developer: This video tutorial was created by scott (https://www.unix.com/members/302063521.html) for forum users. Everyone should use code tags...
15,403
Posted By pravin27
try this, #!/bin/sh for i in {1..4} ...
try this,


#!/bin/sh

for i in {1..4}
do
awk 'NR==FNR{a[$5]=++i;next} { if ( $5 in a) {print $0}}' $i.xyz $i.txt > EF_$i
done
15,403
Posted By pravin27
try this, awk 'NR==FNR{a[$5]=++i;next} { if...
try this,

awk 'NR==FNR{a[$5]=++i;next} { if ( $5 in a) {print $0}}' 3.xyz 3.txt
Showing results 1 to 14 of 14

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