Search Results

Search: Posts Made By: bioinfo
3,120
Posted By Jotne
awk ' NR==FNR {a[$0]=$0;next} {for (i in a) ...
awk ' NR==FNR {a[$0]=$0;next}
{for (i in a)
{gsub(a[i],"\033[1;31m&\033[0m",$0)}
}1
' b.txt a.txt

NR==FNR {a[$0]=$0;next}
NR==FNR This is a technique used to do something on the first...
3,120
Posted By bartus11
Jotne, post output of:cat -ev a.txt cat -ev...
Jotne, post output of:cat -ev a.txt
cat -ev b.txt
3,120
Posted By Jotne
@bartus11 Here is what I got when run your code...
@bartus11
Here is what I got when run your code
perl -lpe 'BEGIN{open b, "b.txt";chomp(@b=<b>)}{for $i (@b) {s/$i/\033[31m$i\033[0m/g}}' a.txt
Seq1...
3,120
Posted By bartus11
bioinfo, don't put my code in a file. Simply run...
bioinfo, don't put my code in a file. Simply run it in a terminal as I posted it, replacing a.doc and b.txt for the filenames you have (in case they differ from those two).
3,120
Posted By Jotne
s#%#%&E#&%!!! There was space after code in...
s#%#%&E#&%!!!

There was space after code in b.txt
Since I just copied it from post #1, I did not check.

cat -ev b.txt
GACAAGT $
AAAAAG $
TAATG$
CAAGC$
ACG $
GCTTG$

Now both awk and...
3,120
Posted By bartus11
Try:perl -lpe 'BEGIN{open b,...
Try:perl -lpe 'BEGIN{open b, "b.txt";chomp(@b=<b>)}{for $i (@b) {s/$i/\033[31m$i\033[0m/g}}' a.doc
4,244
Posted By hanson44
Yes, awk does not usually care about the spacing....
Yes, awk does not usually care about the spacing. A short one-liner is convenient and easy to read. But once the script is longer than say about 60 or so characters, it gets progressively harder to...
4,244
Posted By Don Cragun
If is logically possible to write any awk script...
If is logically possible to write any awk script as a single line, if you're willing to type it into your shell. If the awk program is in a shell file to be executed, you'll have to restrict the...
4,244
Posted By hanson44
There is no hard and fast rule. cut and paste go...
There is no hard and fast rule. cut and paste go together, and are very useful, along with join. cat is not needed that much. grep finds lines. sed makes quick arbitrary changes. awk works well with...
4,244
Posted By Don Cragun
The awk utility maintains several variables as it...
The awk utility maintains several variables as it processes a line of text from a file. As you already know, NR is the number of records that have been read from all of the input files. FNR is the...
4,244
Posted By Don Cragun
Besides being unneeded, if you cat the files...
Besides being unneeded, if you cat the files instead of letting awk open them, awk can't recover the filenames. The awk command can easily perform arithmetic calculations (such as subtracting the...
4,244
Posted By Don Cragun
Does this help? awk ' FNR==1{ # This is the...
Does this help?
awk '
FNR==1{ # This is the first line in a new file...
fn = substr(FILENAME, 5, 3) # Save 3 characters from this filename
n = 0 # Clear number of comments found...
4,244
Posted By Don Cragun
You also have mismatched single quotes in the awk...
You also have mismatched single quotes in the awk command in your pipeline. Please be more careful in the future when you post samples of code.

It is hard to tell with the minimal sample input...
4,244
Posted By Don Cragun
If you don't show us sample output that matches...
If you don't show us sample output that matches what you say you want to have done, we can't figure out what you really want. You say you only want the 2nd and 4th columns, but your sample output...
1,162
Posted By RudiC
What are the parameters to st? Does it need other...
What are the parameters to st? Does it need other input than the pattern file? So you produced cat st_input
2
1
2 - what do you do with it? It is not used anywhere.
1,175
Posted By DGPickett
In bash it seems easy:$ for x in {0..30}; do echo...
In bash it seems easy:$ for x in {0..30}; do echo $x; done
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
835
Posted By Chubler_XL
Try the following from bash for VAL in...
Try the following from bash

for VAL in {0..30}
do
echo "Producing for CUTOFF: $VAL"
perl program.pl input.txt output.txt CUTOFF $VAL > groups_$VAL.txt
done

or for VAL in `seq 0...
857
Posted By Scrutinizer
Try: awk 'NR==FNR{A[$1]; next} $1 in A && $2 in...
Try:
awk 'NR==FNR{A[$1]; next} $1 in A && $2 in A' 1.txt 2.txt
2,348
Posted By Scrutinizer
No it would leave only the first line ...
No it would leave only the first line

---------- Post updated at 04:19 AM ---------- Previous update was at 04:14 AM ----------





$ printf 'This\n\nis\n$a sample\n'
This

is
$a...
2,348
Posted By srinivas matta
sed '/^[# The].*/d' $file it delete the...
sed '/^[# The].*/d' $file

it delete the lines stared with # and The.

like
File is....
#srinivas
The book
To Scrutinizer

Here it delete first two lines only

---------- Post updated at...
2,348
Posted By Scrutinizer
I tried to translate it into what the net effect...
I tried to translate it into what the net effect would be. It effectively deletes (does not print) lines that start with those characters / it prints lines that do not start with these characters. ...
2,348
Posted By Don Cragun
This means: delete any line that starts with ^,...
This means: delete any line that starts with ^, $, | or # ..[/QUOTE]
No. This grep looks for any line in file that starts with any character except for the characters $, |, ^, and #.
...
2,348
Posted By Scrutinizer
This means: delete any line that starts with #,...
This means: delete any line that starts with #, space, T, h, or e ..

This means: delete any line that starts with ^, $, | or # ..
2,348
Posted By srinivas matta
we can use below sed command also sed '/^[#...
we can use below sed command also

sed '/^[# The].*/d' $file
2,348
Posted By Yoda
grep '^[^$|^#]' file
grep '^[^$|^#]' file
Showing results 1 to 25 of 52

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