Search Results

Search: Posts Made By: mikey11415
1,071
Posted By Yoda
awk '$1!=$2' file
awk '$1!=$2' file
1,002
Posted By elixir_sinari
awk '!/^>/{while(length%3) $0=$0 "X";if(!length)...
awk '!/^>/{while(length%3) $0=$0 "X";if(!length) $0="XXX"}1' infile
3,552
Posted By suresh.boddepu
TRY
echo "ATGACTGtagctagATGCTgtg" |sed 's/[a-z]/N/g'


Best Regards,
Suresh...
3,552
Posted By alister
And for the sake of portability, both character...
And for the sake of portability, both character arrays should be of the same length.tr '[:lower:]' '[N*]'or for this specific case
tr acgt '[N*4]'or
tr acgt NNNNRegards,
Alister
1,798
Posted By joeyg
Take a look at previous posts
https://www.unix.com/shell-programming-scripting/136140-passing-parameters-value-object-shell-script.html

Essentially, the first parameter becomes $1 and the second becomes $2 and so on....
1,798
Posted By m.d.ludwig
Create the file (with an added check): #!...
Create the file (with an added check):
#! /usr/bin/awk -f

NR==1
NR>1{ for (i=1; i<=NF; i++) { a+=$i; }
END { if (NR > 1) { for (i=1;i<=NF;i++) {printf a[i]/(NR-1) "\t";} } print ""; }Make it...
7,976
Posted By m.d.ludwig
Is the "tree no" field significant? Assuming it...
Is the "tree no" field significant? Assuming it is not:

awk '
BEGIN { FS = "\t"; }
NR == 1 { print; next; }
{ for (i = 1; i <= NF; i++) { sum += $i; } }
END {
printf "\t";
...
7,976
Posted By bartus11
Try: awk 'NR==1;NR>1{for...
Try: awk 'NR==1;NR>1{for (i=1;i<=NF;i++){a[i]+=$i}}END{for (i=1;i<=NF;i++){printf a[i]/(NR-1)" "};printf "\n"}' file
3,372
Posted By agama
I'm not the sed expert, so removing the last two...
I'm not the sed expert, so removing the last two lines is beyond me. Removing the first two lines in one command is pretty straight forward:


sed '1,2d' <file


1,2d reads: delete the range of...
2,226
Posted By Scott
Hi. Try: $ awk '$1=substr($1, 7,...
Hi.

Try:


$ awk '$1=substr($1, 7, 10)' file1
7147.1Ptv3 CTTGAACAT
7149.1Ptro CTTGAACAT
7891.1Hs3. CTTGAACATTTGC


(according to your output, you've taken characters 7 thru 16...)
16,956
Posted By agama
What is important is that you are trying, and...
What is important is that you are trying, and learning. We all had to start somewhere and every once in a while I come across some of my old code and wonder why I ever did it that way!!
16,956
Posted By konsolebox
Hello. I hope you don't mind another suggestion....
Hello. I hope you don't mind another suggestion. Try to use getline instead:
awk '
BEGIN {
while (getline < ARGV[1]) {
a = $1

if (!(getline < ARGV[2])) {
...
16,956
Posted By agama
There are a couple of ways that you could go...
There are a couple of ways that you could go about this. What makes the difference is what is in the two files. A single line in each, or wanting every line processed, is pretty straight forward. ...
16,956
Posted By agama
You are most welcome. Your analysis of the...
You are most welcome. Your analysis of the programme was spot on.

I'm sure some will suggest something less easy to read -- I prefer to err on the side of easy to maintain:


awk '
...
16,956
Posted By agama
Something like this: awk ' /_X/...
Something like this:


awk '
/_X/ || /_Y/ { print; next; }
{ print; print; }
' input-file-name


This is simple enough that you're on your own to figure out why it works :)
Showing results 1 to 15 of 15

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