Search Results

Search: Posts Made By: @man
1,565
Posted By balajesuri
This will work for any number of columns you have...
This will work for any number of columns you have after col #4.

#! /usr/bin/perl -w
use strict;

# Open the input.txt for reading in filehandle FILE
open FILE, "< input.txt";
my $totCols = 0;...
4,796
Posted By alister
That assertion is unjustified and may fill the OP...
That assertion is unjustified and may fill the OP with unwarranted confidence.

To be clear, I am not suggesting that there is something inherently wrong with Scrutinizer's code. What I am saying...
4,796
Posted By mjf
Without substr: echo...
Without substr:


echo 'Center=128181;Length=461' | nawk -F '=|;' '{ print $2 }'



128181
4,796
Posted By RudiC
awk 'match ($0, /=.*;/){print substr($0,...
awk 'match ($0, /=.*;/){print substr($0, RSTART+1, RLENGTH-2)}' file
128181
2,265
Posted By elixir_sinari
Factoring out the common string chr: awk '$1 ~...
Factoring out the common string chr:
awk '$1 ~ /^chr(2L|2R|3L|3R|4|X)$/' input | sort -k1,1 -k2,2n
Try to avoid regex's if you can, to improve efficiency. Also, if you happen to know, to a...
2,265
Posted By alister
I was about to respond to this post to say...
I was about to respond to this post to say exactly what you added in your edit. I agree completely.

Shorter isn't always better. That said, the original version can be simplified a little bit:
...
2,265
Posted By Yoda
You could do: awk '$1 ~ /^chr[2-4]*[LRX]*$/'...
You could do:
awk '$1 ~ /^chr[2-4]*[LRX]*$/' input | sort -k1,1 -k2,2n
EDIT: But If you want to match strictly only chr2L || chr2R || chr3L || chr3R || chr4 || chrX, then above regexp is wrong.
...
2,350
Posted By bartus11
Change print "$TF[$i]"; to print "$TF[$i]\t" ....
Change print "$TF[$i]"; to print "$TF[$i]\t" . rand(1) . "\n";.
2,600
Posted By elixir_sinari
With some assumptions: perl -lane ' ...
With some assumptions:
perl -lane '
@temp=split /[=;]/,$F[1];
for ($i=0;$i<@temp;$i+=2) {
if(not exists $val{$temp[$i] . " " . $F[0]}) {
$val{$temp[$i] . $F[0]}=$temp[$i+1]
}
else {
...
3,829
Posted By pamu
Yeah just corrected the code. Please check now..:)
Yeah just corrected the code. Please check now..:)
1,641
Posted By elixir_sinari
This is a (very) slight modification to the...
This is a (very) slight modification to the previous script. You should've mentioned this requirement earlier.
awk 'NR>1{name[NR-1]=$1;for(i=2;i<=NF;i++) if($i==1) { oneset[NR-1,i]=1;count[NR-1]++}}...
1,641
Posted By elixir_sinari
awk 'NR>1{name[NR-1]=$1;for(i=2;i<=NF;i++)...
awk 'NR>1{name[NR-1]=$1;for(i=2;i<=NF;i++) if($i==1) oneset[NR-1,i]=1}
END{
for(i=1;i<=(NR-1);i++)
{
if(i==1)
{
print "*"
for(j=1;j<=(NR-1);j++)
print name[j]
printf "\n"
}
...
2,040
Posted By RudiC
Try for i in gi*; do echo mv \"$i\"...
Try
for i in gi*; do echo mv \"$i\" ${i//[|:]/_}; done
The ${i//[|:]/_} is a bash Pattern substitution, so don't expect it to work with other shells.

If happy with the result, remove the echo...
2,040
Posted By RudiC
Try this:while read BAM REGION; do samtools view...
Try this:while read BAM REGION; do samtools view $BAM chrname:$REGION >> $REGION.txt; done <fileremove the region*.txt files before use.
2,257
Posted By Corona688
Leave off 'infile' and awk will read from...
Leave off 'infile' and awk will read from standard input instead.
2,257
Posted By Scrutinizer
Try a for loop for the intermediate values, for...
Try a for loop for the intermediate values, for example:
awk '
p q !=$1 $2{
if(p)print p,q,t,v
t=1
for(i=q+1; i<$2; i++)
printf "- %s 0 -\n", i
p=$1
q=$2
v=$3...
1,945
Posted By elixir_sinari
for i in *.bigWig do bigWigToBedGraph $i...
for i in *.bigWig
do
bigWigToBedGraph $i ${i/%bigWig/bedGraph}
done
1,831
Posted By bartus11
It is part of printf format string. You can read...
It is part of printf format string. You can read more about printf here: printf format string - Wikipedia, the free encyclopedia (http://en.wikipedia.org/wiki/Printf)

Single quotes (') are just...
1,831
Posted By bartus11
Try: #!/bin/bash while true; do ...
Try: #!/bin/bash
while true;
do
clear;
date |
awk '{print $4}' |
awk -F ":" '{print substr($1,0,1) "\t" substr($1,2,1) "\n" substr($2,0,1) "\t" substr($2,2,1...
32,063
Posted By Tribe
You need faToTwoBit compiled in Windows exe (PE)...
You need faToTwoBit compiled in Windows exe (PE) format but against cygwin1.dll not the native windows dll. You can't run native ELF binaries on Cygwin.

As fas as I know, the faToTwoBit...
1,525
Posted By PikK45
@@man: this should help you. awk...
@@man:
this should help you.
awk '{if($4==8){i=$1+$2;} else{i=$1;} print i"\t"$3"\t"$4}' man.txt | sort -nk 3
Input:

1 100 1 0
5 100 1 8
7 50 1 0
7 ...
20,085
Posted By itkamaraj
$ awk '{print $3,$2,$4}' input.txt | sort | uniq...
$ awk '{print $3,$2,$4}' input.txt | sort | uniq -c | awk '{print $3,$2,$1,$4}' | sort -n
1 10M 1 AAATTTCCGG
5 4M 1 ACGT
5 8M 3 ACCTTGGA
20 12M 3 AACCTTGGCCTT
20 3M 2 TCG
20,085
Posted By radoulov
awk 'END { for (k in c) print...
awk 'END {
for (k in c)
print k, c[k], d[k]
}
{
k = $2 OFS $3
c[k]++; d[k] = $NF
}' <filename>
20,085
Posted By radoulov
Let us know if the order matters (or just add |...
Let us know if the order matters (or just add | sort -nk1 -k2after the script).

awk 'END {
for (k in c)
print k, c[k], d[k]
}
{
k = $2 OFS $3
c[k]++; d[k] = $NF
}' infile
233,492
Posted By google
Hard to read here I think since the spacing is...
Hard to read here I think since the spacing is off. Here is the
Link (http://www.faqs.org/faqs/unix-faq/shell/shell-differences/)

Shell features

This table below lists most features...
Showing results 1 to 25 of 25

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