Search Results

Search: Posts Made By: pathunkathunk
11,564
Posted By Don Cragun
You're close, but shell variables aren't known in...
You're close, but shell variables aren't known in an awk script unless you explicitly pass them in. And, in awk $var prints the field named by the field number contained in the awk variable var (and...
3,840
Posted By RavinderSingh13
Hello pathunkathunk, You can try following...
Hello pathunkathunk,

You can try following code for same.

awk 'FNR==NR{X[$1]=$0;next} ($1 in X){print X[$1]}' file2 file1


Thanks,
R. Singh
3,081
Posted By bartus11
I'd say this is some kind of bioinformatics data....
I'd say this is some kind of bioinformatics data. Anyway, you can try this in a directory containing your files:
perl -lne '$,="...
3,611
Posted By itkamaraj
sorry.. i didnt understand your question... ...
sorry.. i didnt understand your question...

so, you mean.. if any of the column sum is less than 8, then it should not print the line ?

---------- Post updated at 12:30 PM ---------- Previous...
3,088
Posted By Perderabo
I think you're missing a semi-colon. Try this: ...
I think you're missing a semi-colon. Try this:
sed -n "$line_number { n; p; q;}" en.pep
3,088
Posted By MadeInGermany
Many Unix sed have bugs with semicolon - newline...
Many Unix sed have bugs with semicolon - newline works better
sed -n "$line_number {
n
p
q
}
" en.pep
3,728
Posted By Scrutinizer
Small variation in the first part: awk...
Small variation in the first part:
awk 'NR==FNR{i=$1; $1="_host"; A[i]=$0; next} {print $0 A[$4]}' OFS=_ file2 FS='[|.]' file1
3,728
Posted By Don Cragun
You could try something like: awk ' FNR == NR...
You could try something like:
awk '
FNR == NR {
x[$1] = "_host"
for(i = 2; i <= NF; i++)
x[$1]=x[$1] "_" $i
next
}
{ print $0 x[$4]
}' File2...
1,266
Posted By durden_tyler
$ $ cat f03 ...
$
$ cat f03
>gi|31425523|gb|AY987736.1|_Macrosiphum_rosae
TCCGTGGAGATGCACCACGAAGCT
>gi|512740870|gb|JX507490.1|_Macrosiphum_funestum
GTCGTGTAGAAA-CTGGTCTT...
1,567
Posted By vidyadhar85
try.. awk '{lines[NR] =...
try..


awk '{lines[NR] = $0}!/>/&&length($0) < 11 {print lines [NR-1]; print lines [NR]} ' example.txt
1,350
Posted By RudiC
Do your data always come in pairs? If yes, your...
Do your data always come in pairs? If yes, your code is fine. Try also$ while read HEAD; do read DATA; [ ${#DATA} -lt 10 ] && printf "%s\n%s\n" "$HEAD" "$DATA"; done < file
>gi|bcd| Species two...
1,350
Posted By mirni
Like this? awk '/^[^>]/ && length($0)<10{print...
Like this?
awk '/^[^>]/ && length($0)<10{print hdr"\n"$0}{hdr=$0}' input
4,180
Posted By Don Cragun
You could try something like: #!/bin/ksh #...
You could try something like:
#!/bin/ksh
# SYNOPSIS:
# colcheck [file [first_column [last_column [threshhold [pass_count]]]]]
# DESCRIPTION:
# Print all lines in the file named by "file"...
4,180
Posted By rdrtx1
try also: awk '{count=0; for (col=6; col<=20;...
try also:
awk '{count=0; for (col=6; col<=20; col++) ($col >= .75) ? count++ : 0; if (count>=8) print}' infile
4,180
Posted By RudiC
In your sample code, you don't have identical...
In your sample code, you don't have identical thresholds for the columns, but in your spec, you do. I'll assume the latter, as it's easier for a start.
For playing around, it might be best to have...
1,423
Posted By Don Cragun
Try: sed -n '/^>/s/.*)_//;s/:.*//p'
Try:
sed -n '/^>/s/.*)_//;s/:.*//p'
1,423
Posted By Yoda
awk '/>/{gsub(/.*\)_|:.*/,x); print}' file
awk '/>/{gsub(/.*\)_|:.*/,x); print}' file
2,255
Posted By MadeInGermany
sed 's/.:.=//g' The g modifier does multiple...
sed 's/.:.=//g'
The g modifier does multiple substitutions in the line.
1,290
Posted By anbu23
$ awk ' NR == FNR { arr[$1$2]=1; next } arr[$2$1]...
$ awk ' NR == FNR { arr[$1$2]=1; next } arr[$2$1] {print $1, $2} ' file1 file2
m.160140_g.160140 ACYPI46488-PA_product:GLE
2,395
Posted By Corona688
I'm not sure sort can reject non-unique lines...
I'm not sure sort can reject non-unique lines like that. But you forgot to actually tell sort which character you wanted to sort by after -t there.

Since it appears to be a single space, you...
2,370
Posted By agama
Sorry -- I tested it as a multi-line programme,...
Sorry -- I tested it as a multi-line programme, but joined the lines when I posted it and forgot a semicolon.


awk -F \| ' /^>gi/ { printf( ">%s\n", $4 ); getline; print; }' test3.fa
5,178
Posted By aster007
cat file1 | awk '{print $1}' | while read NUM ...
cat file1 | awk '{print $1}' | while read NUM
do
# echo ${NUM}

grep "Gene_${NUM}" file2 2>/dev/null # output to tty or suppress

RC=$?

if [[ ${RC} == 0 ]]...
5,178
Posted By agama
This will use a bit more memory, but saves...
This will use a bit more memory, but saves heavily on I/O as it requires each file to be read only once. Depending on the size of the files, should run much more quickly.


awk '
NR == FNR {...
Showing results 1 to 23 of 23

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