Search Results

Search: Posts Made By: anurupa777
1,563
Posted By pamu
Please post relevant information always. It will...
Please post relevant information always. It will be very helpful

Try

awk 'NR==1{split($0,A)}
NR>1{for(i=2;i<=NF;i++){if($i<200){print $1","A[i-1]":"$i}}}' fileRegards,

pamu
1,378
Posted By Yoda
Why apple is not in the output? aaa 18 26 cdded...
Why apple is not in the output?
aaa 18 26 cdded apple banana melon
aaa 10 35 abcde apple banana grapes melon
I see apple falls under the range 20 to 22 in file1 and this range is in between 18...
2,585
Posted By Scrutinizer
If there are no missing values in file 2 you...
If there are no missing values in file 2 you could try:
awk 'NR==FNR{A[$1]=$2; next}{t=0; for(i=$2; i<=$3; i++)t+=A[i]; print $0, t/($3-$2+1)}' file2 file1
1,883
Posted By RudiC
untested: awk 'FNR==NR {i=0} ...
untested:
awk 'FNR==NR {i=0}
/PATTERN/ {i++}
i
' file
1,883
Posted By pamu
try sth like this... for file in *.txt ...
try sth like this...


for file in *.txt
do

awk 'NR==1{i=0}
/PATTERN/ {i++}
i
' $file > "new"$file

rm $file
done
1,920
Posted By Yoda
awk '$0=="oik"{print p,$0}{p=$0;}'...
awk '$0=="oik"{print p,$0}{p=$0;}' filename
3,177
Posted By PranavEcstasy
modify this code
hi,
This is not the exact output you were expecting, but see if this code can help.



awk '{
if ( $4 < 1000000) print "bin1 :" $0
else if ($4 >= 1000000 && $4 < 2000000) print "bin2 :" $0...
1,128
Posted By spacebar
Try out the below code to read one line from...
Try out the below code to read one line from first file and second file and do your check:
open FILE1,"1.txt" or die "can't open file 1";
open FILE2,"2.txt" or die "can't open file 2";...
1,128
Posted By Chirel
Hi, If what you want is to compare line 1 of...
Hi,

If what you want is to compare line 1 of each file then line 2 of each file etc, then the code is wrong.
The code you show compare line 1 of file1 with all lines of file2 and then same for...
1,397
Posted By RudiC
Try this, test being the input file: sort -t\:...
Try this, test being the input file:
sort -t\: test|paste -sd' \n' -
resulting in
1234:45675:123456 16 bbc1 9813806....... 1234:45675:123456 18 nnb1 98123456.......
2303:13593:137135 16 abc1...
1,993
Posted By Scrutinizer
sed 's/\([^ ]*\)\(.*\)\(\1.*\)/\1\2\ \3/'...
sed 's/\([^ ]*\)\(.*\)\(\1.*\)/\1\2\
\3/' infile
awk 'gsub($1,RS $1) && sub(RS,x)' infile
1,993
Posted By bartus11
Try: perl -pe 's/\*[^*]+\*\s+/$&\n/' file
Try: perl -pe 's/\*[^*]+\*\s+/$&\n/' file
1,722
Posted By elixir_sinari
And if your egrep doesn't support the -o option...
And if your egrep doesn't support the -o option (mine doesn't), you may try this:
awk '{for(i=1;i<NF;i++) if($i=="abc") printf("%s ",$(i+1));print ""}' inputfile
1,722
Posted By Scrutinizer
perl -ne 'print "$1\n" while /abc\s+(.+?)\s/g'...
perl -ne 'print "$1\n" while /abc\s+(.+?)\s/g' file
Showing results 1 to 14 of 14

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