I would like to convert the most frequent and second most frequent duplet in each row to 1 and -1 respectively ...and everything else to 0. please assist
I don't quite understand your output given your description and the input.
My understanding given your sample input would be - counting '-' as 0-s:
What happens if you have TWO strings with the SAME frequency? (as in line R2)
What happens if you have TWO strings which are both highest and the next to highest frequencies? ( like on line R3)
A bit verbose - probably can be done without sorting, but.... awk -f rita.awk myFile where rita.awk is:
This produces the following based on your sample input:
@Scrutinizer: Nice, but that has got a problem with larger duplicate count later in the line. For a line like
it yields
Small modification
would yield the correct
Hi RudiC, but I think the former output is correct, no? CC has the lowest frequency on the line (less than TT) , so it should get -1 ...
--
OK I see, the OP said the second most frequent duplet, I must have misread..
Last edited by Scrutinizer; 04-11-2015 at 09:18 AM..
Hello,
This is a bit complicated for me.
My scenario in MyFile:
Search string1,
When string1 is found, grep the line containing string1, go back over that line in upward direction and grep the first line containing string2.
Here is an example:
MyFile
His email address... (17 Replies)
I need assistance with following requirement, I am new to Unix.
I want to do the following task but stuck with file creation date(sysdate)
Following is the requirement
I need to create a script that will read the abc/xyz/klm folder and look for *.err files for that day’s date and then send an... (4 Replies)
Hi Friends,
Please help me to sort out this problem, I am running this in centos o/s and whenever I run this script I am getting "find: missing argument to `-exec' " but when I run the same code in the command line I didn't find any problem. I am using perl script to run this ... (2 Replies)
Hi all ,
I'm new to unix
I have a checked project , there exists a file called xxx.config .
now my task is to find all the files in the checked out project which references to this xxx.config file.
how do i use grep or find command . (2 Replies)
I need to find whether there is a file named vijay is there or not in folder named "opt" .I tried "ls *|grep vijay" but it showed permission problem.
so i need to use find command (6 Replies)
Yes , I have to find a file in unix without using any find or where commands.Any pointers for the same would be very helpful as i am beginner in shell scritping and need a solution for the same.
Thanks in advance.
Regards
Jatin Jain (10 Replies)
Hello,
I create a file touch 1201093003 fichcomp
and inside a repertory (which hava a lot of files) I want to list all files created before this file :
find *.* \! -maxdepth 1 - newer fichcomp but this command returned bash: /usr/bin/find: Argument list too long
but i make a filter all... (1 Reply)