Search Results

Search: Posts Made By: torchij
914
Posted By Chubler_XL
Try this awk script: awk ' { ...
Try this awk script:

awk '
{
values=split($2,V,";")
sample[NR]=$1
for(i=1;i<=values;i++) {
if(!(V[i] in CI)) {
CI[V[i]]
CH[++col]=V[i]
}
...
1,262
Posted By Yoda
Here is an awk approach: awk ' NR ==...
Here is an awk approach:
awk '
NR == 1 {
for ( i = 1; i <= NF; i++ )
{
if ( i > 1 )
printf $i...
1,978
Posted By RudiC
Try awk 'BEGIN{FN=1} NF==0 {FN++;next} {print $0...
Try awk 'BEGIN{FN=1} NF==0 {FN++;next} {print $0 ">" "file_new"FN}' file
1,978
Posted By rbatte1
You could do something very descriptive like...
You could do something very descriptive like this:-#!/bin/ksh
count=1
while read line
do
if [ "$line" != "" ]
then
echo "$line" >> file_new$count.txt
else
...
1,978
Posted By SriniShoo
awk '{print $0 > "file_new" NR ".txt"}' RS=...
awk '{print $0 > "file_new" NR ".txt"}' RS= file.txt
6,221
Posted By bartus11
Try:awk '$2~","{n=split($2,a,",");for...
Try:awk '$2~","{n=split($2,a,",");for (i=1;i<=n;i++) {$2=a[i];print};next}1' OFS="\t" file
6,221
Posted By Scrutinizer
Or in this particular case try: awk '{$1=$1;...
Or in this particular case try:
awk '{$1=$1; gsub(/,/, OFS $3 OFS $4 ORS $1 OFS)}1' OFS='\t' file
1,559
Posted By Scrutinizer
Another approach, reading the input file twice: ...
Another approach, reading the input file twice:
awk '
NR==FNR {
if(NR>1) for(i=2; i<=NF; i++) if( $i!="NA" ) {
S[i]+=$i
N[i]++
}
next
}
{
if(NR>1)...
1,559
Posted By Yoda
An approach using awk: awk ' BEGIN { ...
An approach using awk:
awk '
BEGIN {
CONVFMT = "%.2f"
}
NR == 1 {
print $0
}
NR > 1 {
for ( i = 1; i...
4,474
Posted By Corona688
awk 'NR==1 { $2=$2"\t"NEWcol" ; print ; next } ...
awk 'NR==1 { $2=$2"\t"NEWcol" ; print ; next }
{ A[$2]++ ; $2=$2"\t"A[$2] } 1' inputfile
1,995
Posted By Yoda
You didn't mention what system you are using. ...
You didn't mention what system you are using.

In bash you could do sequence expression that takes the form {x..y}
paste file{1..n}
2,221
Posted By RudiC
awk ' {Xsum+=$1; Ysum+=$2} ...
awk ' {Xsum+=$1; Ysum+=$2}
!(NR%bin) {print Xsum/bin, Ysum/bin; Xsum=Ysum=0}
' bin=3 file.txt
2 2
5 10
8 38.3333
There's nothing foreseen for residual...
34,093
Posted By jim mcnamara
Unsynchronized means the readers of the file read...
Unsynchronized means the readers of the file read whatever they want to read whenever they need to read it.

You can have large number of processes reading a file at exactly the same time. If you...
34,093
Posted By alister
Unsynchronized simultaneous reads are not a...
Unsynchronized simultaneous reads are not a problem.

Regarding the example you gave, though, it could be accomplished in a single pass by a single process (sed or awk, to name a couple tools).
...
1,544
Posted By itkamaraj
this works for n number of columns $ n=$(awk...
this works for n number of columns

$ n=$(awk -F: 'NF>a{a=NF}END{print a}' input.txt);
$ awk -F: -v n="$n" '{for(i=1i<=n;i++)if($i=="")$i="."}NF==n{gsub(":"," ")}1' input.txt
a b c d e f g h i ....
1,544
Posted By pamu
awk -F ":"...
awk -F ":" 'NF<5{for(i=(NF+1);i<=5;i++){$i="."}}{$1=$1}1' OFS="\t" file
1,239
Posted By pamu
try this.. awk -F "[()]" '{...
try this..


awk -F "[()]" '{ for(i=2;i<=NF;i+=2){if(!X[$i]++){printf "("$i")"}}{delete X;print ""}}' file
1,239
Posted By Scrutinizer
sed -e ':a' -e 's/\(([^)]*)\)\(.*\)\1/\1\2/;ta'...
sed -e ':a' -e 's/\(([^)]*)\)\(.*\)\1/\1\2/;ta' infile
1,239
Posted By spacebar
See if the below code will work for you: $ cat...
See if the below code will work for you:
$ cat t
(56)(63)
(56)(70)(56)(70)(24)
(25)(78)
(12)(33)(12)
(10)
(10)

$ while read l
> do
> echo "$l" | sed -e 's/)(/)\n(/g' -e 's/)$/)\n/' |...
1,239
Posted By Don Cragun
The following will doing it without creating an...
The following will doing it without creating an intermediate file:
awk -F ")" '{
for(i=NF;i>0;i--)
for(j=1;j < i;j++)
if($i == $j) {
...
6,083
Posted By vgersh99
awk '{idx=$1 OFS $2 OFS $3 OFS $4}{a[idx]=(idx in...
awk '{idx=$1 OFS $2 OFS $3 OFS $4}{a[idx]=(idx in a)?a[idx]";"$NF:$NF}END{for(i in a) print i,a[i]}' myFile
6,452
Posted By Don Cragun
I think you're asking for something like: awk '...
I think you're asking for something like:
awk ' function abs_diff(a,b) { return a > b ? a - b : b - a; } abs_diff(length($3),length($4)) >= 3 {print}' < genome_data
or
awk ' function abs_diff(a,b)...
6,452
Posted By vgersh99
hmmm... my head starts hurtin' a bit...... ...
hmmm... my head starts hurtin' a bit......

nawk 'sqrt((length($3)-length($4))^2) >=3' myfile
Showing results 1 to 23 of 23

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